npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-downloader-manager

v1.0.11

Published

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.

Downloads

938

Readme

🌟 node-downloader-manager

📥 DownloadManager

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.

📚 Table of Contents

✨ Features

  • Supports both simple and queue-based download methods.
  • Handles multiple concurrent downloads with customizable concurrency limits.
  • Supports pausing, resuming, and canceling downloads.
  • Provides detailed progress and error reporting.
  • Allows custom file naming and pre/post-download hooks.
  • Supports streaming downloads for large files.

📦 Installation

You can install node-downloader-manager using your favorite package manager:

npm

npm install node-downloader-manager

yarn

yarn add node-downloader-manager

pnpm

pnpm add node-downloader-manager

bun

bun add node-downloader-manager

🚀 Usage

Here's how you can use node-downloader-manager in your project:

Examples

More Examples

https://github.com/nextyfine-dev/node-downloader-manager/tree/master/src/examples

Queue Download

import { DownloadManager } from "node-downloader-manager";
// const { DownloadManager } = require("node-downloader-manager"); for cjs

const urls = [
  "https://i.imgur.com/StLyH09.jpeg",
  "https://i.imgur.com/vFopwVJ.png",
  "https://i.imgur.com/NaCQQ8c.jpeg",
  "https://i.imgur.com/GXeeLNx.jpeg",
  "https://i.imgur.com/ElhcT9n.jpeg",
  "https://i.imgur.com/sNNWmtU.png",
  "https://i.imgur.com/Upa7Em5.jpeg",
  "https://i.imgur.com/CTHsEaK.png",
];

// Initialize the DownloadManager with console logging enabled
const downloadManager = new DownloadManager({ consoleLog: true }); // By default method is 'queue'

// Start the download
downloadManager.download(urls);

Stream Download

import { DownloadManager } from "node-downloader-manager";

const url =
  "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
const createFileName = () => "code.deb";

const downloadManager = new DownloadManager({
  stream: true,
  overWriteFile: true,
  getFileName: createFileName,
});

downloadManager.on("start", (data) => {
  console.log(`Download started: ${data?.url}`);
});

downloadManager.download(url);

Simple Download

import { DownloadManager } from "node-downloader-manager";

const urls = [
  "https://i.imgur.com/StLyH09.jpeg",
  "https://i.imgur.com/vFopwVJ.png",
];

const downloadManager = new DownloadManager({
  consoleLog: true,
  overWriteFile: true,
  method: "simple",
});

downloadManager.download(urls);

Pause, Resume, and Cancel Download

import { DownloadManager } from "node-downloader-manager";

const url =
  "https://code.visualstudio.com/sha/download?build=stable&os=linux-deb-x64";
const createFileName = () => "code.deb";

const downloadManager = new DownloadManager({
  stream: true,
  overWriteFile: true,
  getFileName: createFileName,
});

downloadManager.on("start", (data) => {
  console.log(`Download started: ${data?.url}`);
});

setTimeout(() => {
  downloadManager.pauseDownload();
}, 5000);

setTimeout(() => {
  downloadManager.resumeDownload();
}, 8000);

setTimeout(() => {
  downloadManager.cancelDownload();
}, 10000);

downloadManager.download(url);

Thread Download (Beta)

import { DownloadManager } from "node-downloader-manager";

const urls = [
  "https://i.imgur.com/StLyH09.jpeg",
  "https://i.imgur.com/vFopwVJ.png",
  "https://i.imgur.com/NaCQQ8c.jpeg",
  "https://i.imgur.com/GXeeLNx.jpeg",
  "https://i.imgur.com/ElhcT9n.jpeg",
];

const downloadManager = new DownloadManager({
  consoleLog: true,
  method: "thread",
  maxWorkers: 5,
});

downloadManager.download(urls);

📖 API Reference

DownloadManager Options

  • method: "simple" | "queue" - The download method to use.
  • concurrencyLimit: number - Maximum number of concurrent downloads.
  • retries: number - Maximum number of retries for failed downloads.
  • consoleLog: boolean - Enable or disable console logging.
  • downloadFolder: string - Folder to save downloaded files.
  • getFileName: (url: string) => string - Function to generate file names.
  • onBeforeDownload: (url: string, fileName: string) => Promise<void> - Hook before download starts.
  • onAfterDownload: (url: string, fileName: string) => Promise<void> - Hook after download completes.
  • overWriteFile: boolean - Overwrite existing files.
  • requestOptions: RequestInit - Options for the fetch request.
  • stream: boolean - Enable streaming downloads.
  • backOff: boolean - Enable exponential backoff for retries.
  • timeout: number - Timeout for download requests.

Methods

  • download(urls: string | string[]): Start downloading the specified URLs.
  • pauseDownload(url?: string): Pause the download for a specific URL or the current download.
  • resumeDownload(url?: string): Resume the download for a specific URL or the current download.
  • cancelDownload(url?: string): Cancel the download for a specific URL or the current download.
  • pauseAll(): Pause all active downloads.
  • resumeAll(): Resume all paused downloads.
  • cancelAll(): Cancel all active downloads.

Events

  • start: Emitted when a download starts.
  • progress: Emitted periodically with download progress.
  • complete: Emitted when a download completes.
  • error: Emitted when a download fails.
  • cancel: Emitted when a download is canceled.
  • paused: Emitted when a download is paused.
  • resumed: Emitted when a download is resumed.
  • exists: Emitted if the file already exists.
  • finished: Emitted when all downloads are finished.

🤔 Why Use DownloadManager?

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.

🤝 Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.


📝 License

This project is licensed under the MIT License. See the LICENSE file for more details.