resumable multi-threaded download over http/https
npm install mt-downloaderThis is a nodejs based module that helps you in performing resumable, multi-threaded downloads via Http. The module is highly inspired by Speedbit's — Download Accelerator Plus.
0. Stop and start from the last downloaded byte:. You don't have to worry about internet getting disconnected or your computer shutting down while downloading. You can quite easily start from the last byte that was downloaded.
0. Console application: If installed globally, mtd command would be available.
The conventional npm installation process needs to be followed.
``bash`
npm install mt-downloader --save-dev
`javascript`
var createDownload = require('mt-downloader').createDownload
var url = 'https://upload.wikimedia.org/wikipedia/commons/4/47/Gadget_the_pug_expressive_eyes.jpg';
var path = '/Users/tusharmathur/Desktop/temp/Gadget_the_pug_expressive_eyes.jpg';
var downloader = createDownload({path, url});
downloader.start() // returns an observable
The start() method returns an observable. It can easily be converted into a promise by calling toPromise() method on it.
`js`
downloader.start().toPromise()
`javascript`
//File should have NOT have .mtd extension
var path = '/Users/tusharmathur/Desktop/temp/Gadget_the_pug_expressive_eyes.jpg'
var downloader = createDownload({path})
downloader.download().toPromise()
property.`javascript
const downloader = createDownload({path, url})
downloader.stats.subscribe(x => console.log(x))
downloader.start()/*
OUTPUT {event: , message: }
...
...
...
*/
`
Events include — -
INIT: Fired as soon as the download is created.
- CREATE: Fired when a .mtd file is created.
- DATA: Fired every time some packet of data is SAVED.
- TRUNCATE: Fired once the meta info is removed from the .mtd file.
- RENAME:Fired once the file is renamed from .mtd` to the original name.