A simple command-line download manager built with Node.js that supports downloading files from direct URLs and torrent links. This tool provides visual feedback during downloads through a progress bar.
Features
- Download files from direct HTTP/HTTPS links.
- Download files from magnet links using WebTorrent.
- Read multiple download links from a .txt file.
- Progress bar display for ongoing downloads.
- Automatically creates a downloads directory on the desktop.
Requirements
- Node.js (version 12 or higher)
- npm (Node Package Manager)
Installation
-
Clone this repository or download the script file.
-
Navigate to the project directory in your terminal.
-
Install the required packages:
npm install webtorrent
To use the download manager, run the script with a URL or a path to a .txt file containing URLs. The script supports both direct download links and magnet links.
Command Line Usage
node jsdownloader.js <url/magnet link/.txt>
Examples
-
Download a single file
node jsdownloader.js https://example.com/file.zip
-
Download a magnet link
node jsdownloader.js "magnet:?xt=urn:btih:..."
Magnet link require "quotes".
-
Download multiple files from a .txt file. Create a downloads.txt file with the following contents:
https://example.com/file1.zip https://example.com/file2.zip "magnet:?xt=urn:btih:..."
Then run
node jsdownloader.js downloads.txt
Drag and drop link to terminal are supported.
This script draws colored progress-bar on the console based on the provided progress. The progress bar will indicate the download status, changing colors based on the progress:
Progress | Color |
---|---|
0% - 49% | Red |
50% - 999% | Yellow |
99% - 100% | Green |
Downloaded files will be saved in a downloads directory on your desktop, which will be created automatically if it does not exist.
- Windows: Desktop/downloads (default)
- macOS: Desktop/downloads (default)
- Linux: Desktop/downloads (default)
If an error occurs during the download process, the script will log the error message to the console and continue downloading the next file if applicable.
The script uses Node.js and several native modules (https, fs, path, os). Cross platform, (Windows/macOS/Linux).
Contributions are welcome! Feel free to submit a pull request or open an issue for any enhancements or bug fixes.
- WebTorrent for enabling torrent downloads.
- Node.js for providing a powerful runtime for building this application.