1 Star 0 Fork 0

Augly / bigfileupload

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

安装

npm install bigfileupload

引用

important { BigFileUpload } from "bigfileupload"

配置项

option:{
      //切片尺寸
      sliceSize: 0.1 * 1024 * 1024,
      //为一个函数接收三个参数(sliceFile,next,error)=>{},该函数作用于上传文件切片,调用next()执行下一个,调用error()主动抛出错误,停止上传,
      uploadFun: (sliceFile, next,error) => { },
      //为一个函数接收两个参数(fileName,hashName)=>{},此函数通知服务器端该文件所有切片已上传完毕,可以合并
      noticeFun: (fileName, hashName) => { },
      //为一个函数接收两个参数(fileName,hashName)=>{},此函数验证该文件在服务器端已上传切片数量,该函数返回2个值,uploaded为布尔值类型,uploadedList为切片hash值组成的数组组成的数组
      verifyFun: (fileName, hashName) => { },
      //为一个函数接收一个参数(progres)=>{},此函数通知用户已上文件的占比
      progressFun: (progres) => { },
      //接收一个status,表示当前上传状态
      status: (status) => { },
      //接收一个msg,表示错误信息
      errorMsg: (msg) => {
        console.error(msg)
      },

创建实例

const upload = new BigFileUpload(option)

方法

load(file):接收需要上传的文件。
//以下方法都在load(file)之后调用
begin():开始上传
again():重新上传
pause():暂停上传
continue():继续上传

Comments ( 0 )

Sign in for post a comment

About

This is a js breakpoint continuation utility class function that supports starting, pausing, re-uploading, and throwing errors on your own initiative。这是一个js断点续传工具类函数,支持开始,暂停,重新上传,并且可以自已主动抛出错误" spread retract
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
JavaScript
1
https://git.oschina.net/Q_Augly/bigfileupload.git
git@git.oschina.net:Q_Augly/bigfileupload.git
Q_Augly
bigfileupload
bigfileupload
master

Search

103611 48b8ff67 1899542 103622 4d02230c 1899542