mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
ci: testing pipeline
This commit is contained in:
parent
5bec457ba6
commit
3b5f3da2ab
27 changed files with 1349 additions and 1399 deletions
17
src/main/workers/torrent-parser.worker.ts
Normal file
17
src/main/workers/torrent-parser.worker.ts
Normal 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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue