npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fragmentupload-jesse

v1.0.18

Published

分片上传

Readme

  • npm install @plat-components/fragmentupload

  • 默认导出 类, 当选择文件时,直接传入

    参数1: file

    参数2:

          option: {
              creatInput, // 是否自定义input 上传组件 默认true
              multiFile?: Boolean,  // 如果是自定义上传组件,可不传
              fileName,
              queueCount?: number, // 并发数
              customeRequestConfig?: Object, // 自定义 创建分片, merge 时的请求配置
              apiEnv?: string //"uat" "pre" "pro"  // 默认的api 环境
              creatApi?: getCreateParamsFunc, //
              handleError?: handleErrorFunction,
              handleSuccess?: handleSuccessFunction,
              handleProgress?: handleProgressFunction,
              handleCreate?: handleCreateFunction,
              handleBeforeUpload?: handleBeforeUploadFunction
              handlePerFileBefore
          }
    
          fileName: 文件名
          queueCount: 同时并发的请求数 默认 5
          handleBeforUpload(所有文件)
              上传之前, 如果提供该钩子函数, 返回true 则继续上传, 否则,停止上传
          handleError
              接受错误日志
          handleSuccess
              参数1: 资源url
              参数2: 传入的options
          getCreateParamsFunc: 自行传入分片信息, 该方法,返回值必须符合
              {
                  part_args: Array<PartArgsItem>,      type PartArgsItem = {
                  upload_id: string                                   part_no: number,
              }                                                       part_size: number
                                                                      upload_url: string
                                                                  }
          handleProgress接收一个对象
              {
                  file // 正在上传的文件
                  upload_id // 上传唯一的id
                  fragment_index, // 分片索引
                  loaded: e.loaded, // 上传当前分片的 总字节
                  fragment_total: 当前文件的的分片个数,
              }
    
          handleCreate 创建分片成功的回调 
              参数1: file:  当前文件
              参数2: params : {
                  part_args: 分片数组
                  upload_id: 上传唯一id
              }
          handlePerFileBefore 单个文件上传之前的钩子
              参数1: file 当前文件
              返回值: true  继续上传, false 停止上传
    
          customeRequestConfig: 自定义请求头,针对create/merge 两个接口
    <script src="http://boss.hdslb.com/material/static/75198507ea8a19cccd7726600903cd03/a9j99my0es.js?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=4bd6b7b16353c099%2F20220104%2Fshjd%2Fs3%2Faws4_request&X-Amz-Date=20220104T035531Z&X-Amz-Expires=94608000&X-Amz-SignedHeaders=host&X-Amz-Signature=0416716fd6ecd37285f5dccbe9860a9297e4506260535e996c6525a3f5354a9a"></script>
    const load1 = new window.Fragment({
        creatInput: false,
        multiFile: true,
        handleError(e) {
            console.log(e);
        },
        handleCreate(file, params) {
            console.log(file, params);
        },
        handleBeforUpload (e) {
            const arr = Array.from(e)
            return arr
        }
       })
    load1.Upload()
    // es6
    import A from ’@plat-components/fragmentupload‘
    // 初始化
    const load2 = new A({
        creatInput: false,
        multiFile: true,
        handleError(e) {
            console.log(e);
        },
        handleCreate(file, params) {
            console.log(file, params);
        },
        handleBeforUpload (e) {
            const arr = Array.from(e)
            return true
        }
    })
    // 实例 调用Upload, 进行上传, 如果初始化creatInput 为false 时, 这里参数必传, 类型 Array<file>
    load2.Upload()

npm publish 注意修改package.json 里面的verison 版本

然后 直接npm publish