hydra/src/main/workers/torrent-parser.worker.ts
Chubby Granny Chaser dc7591ee28 feat: removing sentry
2024-05-14 16:54:14 +01:00

14 lines
346 B
TypeScript

import { parentPort } from "worker_threads";
import parseTorrent from "parse-torrent";
const port = parentPort;
if (!port) throw new Error("IllegalState");
port.on("message", async (buffer: Buffer) => {
try {
const torrent = await parseTorrent(buffer);
port.postMessage(torrent);
} catch (err) {
port.postMessage(null);
}
});