ci: testing pipeline

This commit is contained in:
Hydra 2024-04-29 11:01:34 +01:00
parent 5bec457ba6
commit 3b5f3da2ab
27 changed files with 1349 additions and 1399 deletions

View file

@ -0,0 +1,17 @@
import { parentPort } from "worker_threads";
import parseTorrent from "parse-torrent";
const port = parentPort;
if (!port) throw new Error("IllegalState");
const getTorrentBuffer = (url: string) =>
fetch(url, { method: "GET" }).then((response) =>
response.arrayBuffer().then((buffer) => Buffer.from(buffer))
);
port.on("message", async (url: string) => {
const buffer = await getTorrentBuffer(url);
const torrent = await parseTorrent(buffer);
port.postMessage(torrent);
});