mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
20 lines
391 B
TypeScript
20 lines
391 B
TypeScript
import { parentPort } from 'worker_threads';
|
|
import { html2md } from './utils';
|
|
|
|
parentPort?.on('message', (params: { html: string }) => {
|
|
try {
|
|
const md = html2md(params?.html || '');
|
|
|
|
parentPort?.postMessage({
|
|
type: 'success',
|
|
data: md
|
|
});
|
|
} catch (error) {
|
|
parentPort?.postMessage({
|
|
type: 'error',
|
|
data: error
|
|
});
|
|
}
|
|
process.exit();
|
|
});
|