UNPKG

node-downloader-manager

Version:

node-downloader-manager is a simple yet powerful package manager-like download manager built with NodeJs. It allows you to download files sequentially or with a queue-based approach, handling retries and concurrency limits efficiently.

19 lines (18 loc) 671 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const node_worker_threads_1 = require("node:worker_threads"); const index_js_1 = require("../index.js"); (async () => { const { id, url, fileName, options } = node_worker_threads_1.workerData; try { const downloadManager = new index_js_1.DownloadManager({ ...options, method: "simple", }); await downloadManager.download(url, fileName); node_worker_threads_1.parentPort?.postMessage({ id, message: "Download complete" }); } catch (error) { node_worker_threads_1.parentPort?.postMessage({ id, error }); } })();