10 Star 40 Fork 9

Cherokee / fast-down

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

fast-down

nodejs 大文件分片下载工具,使用进程process的方式分片下载,文件合并使用filestream,不受nodejs单进程的内存限制可以下载较大的文件。

用法

安装

全局安装

npm install fast-down

如果要全局安装请加上-g参数

全局安装模式下,可以直接当做下载工具使用:

fast-down "http://xxx/big-file.zip" big-file.zip 4

表示4个分片并发下载

在项目中引用:

const fast_down = require('fast-down');

(async() => {
        var url = 'http://bla..../file.mp4';
        var filepath = 'filename.mp4';
        var con_num = 4;

        let stime = new Date().getTime();
        console.log('start download, concurrency: ' + con_num);

        var downloader = new fast_down.Downloader(url, filepath, {
            'concurrency': con_num,
            'progress_throttle': 4000,
            "headers":{
		"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36",
		"Referer":"https://www.bilibili.com/",
		"Origin": "https://www.bilibili.com"
		}
        });

        downloader.onProgress((pct, tinfo, pinfo) => {
            console.log('progress:',pct);
        });

        let ret = await downloader.download();

        console.log('download ' + (ret ? 'success' : 'fail') + ', cost: ' + (new Date().getTime() - stime) + 'ms');
})();

Comments ( 1 )

Sign in for post a comment

About

nodejs 大文件分片下载工具,使用进程process的方式分片下载,文件合并使用filestream,不受nodejs单进程的内存限制可以下载较大的文件,支持断点续传。 spread retract
BSD-3-Clause
Cancel

Releases

No release

fast-down

Contributors

All

Activities

load more
can not load any more
NodeJS
1
https://gitee.com/dreamidea/fast-down.git
git@gitee.com:dreamidea/fast-down.git
dreamidea
fast-down
fast-down
master

Search

102255 3a0e046c 1850385 102255 7aaa926c 1850385