{"id":25030439,"url":"https://github.com/nextyfine-dev/node-downloader-manager","last_synced_at":"2026-02-10T00:33:03.302Z","repository":{"id":273765230,"uuid":"920811066","full_name":"nextyfine-dev/node-downloader-manager","owner":"nextyfine-dev","description":"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.","archived":false,"fork":false,"pushed_at":"2025-02-10T07:38:17.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-29T01:09:26.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextyfine-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-22T20:12:01.000Z","updated_at":"2025-08-25T14:22:32.000Z","dependencies_parsed_at":"2025-01-22T20:51:02.190Z","dependency_job_id":"f8f88901-ef3b-4fbd-bab0-c5267e26852e","html_url":"https://github.com/nextyfine-dev/node-downloader-manager","commit_stats":null,"previous_names":["nextyfine-dev/node-downloader-manager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nextyfine-dev/node-downloader-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Fnode-downloader-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Fnode-downloader-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Fnode-downloader-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Fnode-downloader-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextyfine-dev","download_url":"https://codeload.github.com/nextyfine-dev/node-downloader-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextyfine-dev%2Fnode-downloader-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29287369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T21:57:15.303Z","status":"ssl_error","status_checked_at":"2026-02-09T21:57:11.537Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-05T22:00:11.517Z","updated_at":"2026-02-10T00:33:03.267Z","avatar_url":"https://github.com/nextyfine-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌟 node-downloader-manager\n\n# 📥 DownloadManager\n\n`node-downloader-manager` is a lightweight and efficient file download manager for Node.js applications. It allows you to download files either sequentially or using a queue-based approach, providing features like retry mechanisms, concurrency control, stream, and custom file naming.\n\n## 📚 Table of Contents\n\n- [🌟 node-downloader-manager](#-node-downloader-manager)\n- [📥 DownloadManager](#-downloadmanager)\n  - [📚 Table of Contents](#-table-of-contents)\n  - [✨ Features](#-features)\n  - [📦 Installation](#-installation)\n    - [npm](#npm)\n    - [yarn](#yarn)\n    - [pnpm](#pnpm)\n    - [bun](#bun)\n  - [🚀 Usage](#-usage)\n    - [Examples](#examples)\n      - [More Examples](#more-examples)\n      - [Queue Download](#queue-download)\n      - [Stream Download](#stream-download)\n      - [Simple Download](#simple-download)\n      - [Pause, Resume, and Cancel Download](#pause-resume-and-cancel-download)\n      - [Thread Download (Beta)](#thread-download-beta)\n  - [📖 API Reference](#-api-reference)\n    - [DownloadManager Options](#downloadmanager-options)\n    - [Methods](#methods)\n    - [Events](#events)\n  - [🤔 Why Use DownloadManager?](#-why-use-downloadmanager)\n  - [🤝 Contributing](#-contributing)\n  - [📝 License](#-license)\n\n## ✨ Features\n\n- Supports both simple and queue-based download methods.\n- Handles multiple concurrent downloads with customizable concurrency limits.\n- Supports pausing, resuming, and canceling downloads.\n- Provides detailed progress and error reporting.\n- Allows custom file naming and pre/post-download hooks.\n- Supports streaming downloads for large files.\n\n## 📦 Installation\n\nYou can install `node-downloader-manager` using your favorite package manager:\n\n### npm\n\n```bash\nnpm install node-downloader-manager\n```\n\n### yarn\n\n```bash\nyarn add node-downloader-manager\n```\n\n### pnpm\n\n```bash\npnpm add node-downloader-manager\n```\n\n### bun\n\n```bash\nbun add node-downloader-manager\n```\n\n## 🚀 Usage\n\nHere's how you can use `node-downloader-manager` in your project:\n\n### Examples\n\n#### More Examples\n\n```\nhttps://github.com/nextyfine-dev/node-downloader-manager/tree/master/src/examples\n```\n\n#### Queue Download\n\n```typescript\nimport { DownloadManager } from \"node-downloader-manager\";\n// const { DownloadManager } = require(\"node-downloader-manager\"); for cjs\n\nconst urls = [\n  \"https://i.imgur.com/StLyH09.jpeg\",\n  \"https://i.imgur.com/vFopwVJ.png\",\n  \"https://i.imgur.com/NaCQQ8c.jpeg\",\n  \"https://i.imgur.com/GXeeLNx.jpeg\",\n  \"https://i.imgur.com/ElhcT9n.jpeg\",\n  \"https://i.imgur.com/sNNWmtU.png\",\n  \"https://i.imgur.com/Upa7Em5.jpeg\",\n  \"https://i.imgur.com/CTHsEaK.png\",\n];\n\n// Initialize the DownloadManager with console logging enabled\nconst downloadManager = new DownloadManager({ consoleLog: true }); // By default method is 'queue'\n\n// Start the download\ndownloadManager.download(urls);\n```\n\n#### Stream Download\n\n```typescript\nimport { DownloadManager } from \"node-downloader-manager\";\n\nconst url =\n  \"https://code.visualstudio.com/sha/download?build=stable\u0026os=linux-deb-x64\";\nconst createFileName = () =\u003e \"code.deb\";\n\nconst downloadManager = new DownloadManager({\n  stream: true,\n  overWriteFile: true,\n  getFileName: createFileName,\n});\n\ndownloadManager.on(\"start\", (data) =\u003e {\n  console.log(`Download started: ${data?.url}`);\n});\n\ndownloadManager.download(url);\n```\n\n#### Simple Download\n\n```typescript\nimport { DownloadManager } from \"node-downloader-manager\";\n\nconst urls = [\n  \"https://i.imgur.com/StLyH09.jpeg\",\n  \"https://i.imgur.com/vFopwVJ.png\",\n];\n\nconst downloadManager = new DownloadManager({\n  consoleLog: true,\n  overWriteFile: true,\n  method: \"simple\",\n});\n\ndownloadManager.download(urls);\n```\n\n#### Pause, Resume, and Cancel Download\n\n```typescript\nimport { DownloadManager } from \"node-downloader-manager\";\n\nconst url =\n  \"https://code.visualstudio.com/sha/download?build=stable\u0026os=linux-deb-x64\";\nconst createFileName = () =\u003e \"code.deb\";\n\nconst downloadManager = new DownloadManager({\n  stream: true,\n  overWriteFile: true,\n  getFileName: createFileName,\n});\n\ndownloadManager.on(\"start\", (data) =\u003e {\n  console.log(`Download started: ${data?.url}`);\n});\n\nsetTimeout(() =\u003e {\n  downloadManager.pauseDownload();\n}, 5000);\n\nsetTimeout(() =\u003e {\n  downloadManager.resumeDownload();\n}, 8000);\n\nsetTimeout(() =\u003e {\n  downloadManager.cancelDownload();\n}, 10000);\n\ndownloadManager.download(url);\n```\n\n#### Thread Download (Beta)\n\n```typescript\nimport { DownloadManager } from \"node-downloader-manager\";\n\nconst urls = [\n  \"https://i.imgur.com/StLyH09.jpeg\",\n  \"https://i.imgur.com/vFopwVJ.png\",\n  \"https://i.imgur.com/NaCQQ8c.jpeg\",\n  \"https://i.imgur.com/GXeeLNx.jpeg\",\n  \"https://i.imgur.com/ElhcT9n.jpeg\",\n];\n\nconst downloadManager = new DownloadManager({\n  consoleLog: true,\n  method: \"thread\",\n  maxWorkers: 5,\n});\n\ndownloadManager.download(urls);\n```\n\n## 📖 API Reference\n\n### DownloadManager Options\n\n- `method`: `\"simple\"` | `\"queue\"` - The download method to use.\n- `concurrencyLimit`: `number` - Maximum number of concurrent downloads.\n- `retries`: `number` - Maximum number of retries for failed downloads.\n- `consoleLog`: `boolean` - Enable or disable console logging.\n- `downloadFolder`: `string` - Folder to save downloaded files.\n- `getFileName`: `(url: string) =\u003e string` - Function to generate file names.\n- `onBeforeDownload`: `(url: string, fileName: string) =\u003e Promise\u003cvoid\u003e` - Hook before download starts.\n- `onAfterDownload`: `(url: string, fileName: string) =\u003e Promise\u003cvoid\u003e` - Hook after download completes.\n- `overWriteFile`: `boolean` - Overwrite existing files.\n- `requestOptions`: `RequestInit` - Options for the fetch request.\n- `stream`: `boolean` - Enable streaming downloads.\n- `backOff`: `boolean` - Enable exponential backoff for retries.\n- `timeout`: `number` - Timeout for download requests.\n\n### Methods\n\n- `download(urls: string | string[])`: Start downloading the specified URLs.\n- `pauseDownload(url?: string)`: Pause the download for a specific URL or the current download.\n- `resumeDownload(url?: string)`: Resume the download for a specific URL or the current download.\n- `cancelDownload(url?: string)`: Cancel the download for a specific URL or the current download.\n- `pauseAll()`: Pause all active downloads.\n- `resumeAll()`: Resume all paused downloads.\n- `cancelAll()`: Cancel all active downloads.\n\n### Events\n\n- `start`: Emitted when a download starts.\n- `progress`: Emitted periodically with download progress.\n- `complete`: Emitted when a download completes.\n- `error`: Emitted when a download fails.\n- `cancel`: Emitted when a download is canceled.\n- `paused`: Emitted when a download is paused.\n- `resumed`: Emitted when a download is resumed.\n- `exists`: Emitted if the file already exists.\n- `finished`: Emitted when all downloads are finished.\n\n## 🤔 Why Use DownloadManager?\n\n`node-downloader-manager` is designed to simplify the process of downloading files in Node.js applications. It provides a robust and flexible API for handling downloads, with support for advanced features like streaming, concurrency control, and event-driven progress reporting. Whether you're building a CLI tool, a server-side application, or a desktop app, `DownloadManager` can help you manage downloads efficiently and effectively.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue.\n\n---\n\n## 📝 License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](./LICENSE) file for more details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextyfine-dev%2Fnode-downloader-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextyfine-dev%2Fnode-downloader-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextyfine-dev%2Fnode-downloader-manager/lists"}