aria2c
This is an unofficial npm package containing the unmodified versions of the linux
, darwin
and win32
binaries of aria2c, obtained from here.
All the licenses and credits belong to the original authors of the tool.
Usage:
The package has been specifically published because most of the other downloading libraries ad solutions failed for a particular use case. While it's not recommended to use this if you've other options to download files in Node.js, you can use it like this if you absoutely have to:
const Exec = require('child_process').execFile
let execPath = './node_modules/aria2c-unofficial/'
switch (process.platform) {
case 'win32':
execPath += 'aria2c-win32.exe'
break
case 'darwin':
execPath += 'aria2c-darwin'
default:
execPath += 'aria2c-linux'
break
}
const downloader = Exec(execPath, ['-i', './files.txt', '--auto-file-renaming=false'])
downloader.stdout.on('data', data => {
console.log(data)
})
In the above example, a files.txt
file is generated before the above snippet. For more information on the file structure and other possible options, refer to the official documentation of aria2c.