3.1.0 • Published 1 year ago

downloader-race v3.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

downloader-race

npm version npm downloads

nodejs 下载竞速工具, Node.js-开发实践:下载文件

install

安装

npm install downloader-race

use

使用

// cjs
const { downloadRace } = require('downloader-race');

// mjs
import { downloadRace } from 'downloader-race';

downloadRace

下载竞速工具

  • url
    • 类型: string
    • 说明: 下载文件的 url
  • dest
    • 类型: string
    • 说明: 下载文件的目标路径
  • options
    • options.times
      • 类型: number
      • 说明: 并行下载次数,默认为 2
    • options.timeout
      • 类型: number
      • 说明: 下载文件的超时时间,单位 ms
    • options.onProgress
      • 类型: function
      • 说明: 下载进度,返回保留 3 位的小数
  • return
    • 类型: string
    • 说明: 下载成功后返回目标路径
// download race
const res = await downloadRace(url, dest, options);