large-file-transfer
v1.0.4
Published
大文件分片下载
Downloads
13
Readme
LargeFileTransfer 大文件分片下载
使用说明:
- 1、安装
npm install large-file-transfer
- 2、引入项目
import { DownloadManager } from "large-file-transfer";
3、调用
// 创建下载管理 const manager = new DownloadManager({ chunkSize: 10 * 1024 * 1024, enableSlice: true, sizeRequestCfg: { params: {}, handler: fetchFilesize, }, downloadRequestCfg: { params: {}, handler: fetchDownload, }, }) .listen("FileAdded", (wrap) => { console.log("添加文件监听"); }) .listen("RemoveFile", (wrap) => { console.log("移除文件监听"); }) .listen("Progress", (wrap, info) => { console.log("下载进度监听"); }); // 下载触发函数 function download() { manager.add({ name: "202309080006.zip", }); }