fix: worker un exit (#624)

This commit is contained in:
Archer
2023-12-18 20:35:17 +08:00
committed by GitHub
parent 703583fff7
commit b14a1db2f9
9 changed files with 58 additions and 130 deletions

View File

@@ -13,9 +13,12 @@ export const htmlToMarkdown = (html?: string | null) =>
const worker = new Worker(getWorkerPath('html2md'));
worker.on('message', (md: string) => {
worker.terminate();
resolve(simpleMarkdownText(md));
});
worker.on('error', (err) => {
worker.terminate();
reject(err);
});