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

@chao_yan/bigfileuploader

v1.0.1

Published

A TypeScript SDK for large file upload with chunking, concurrency, and resume support

Readme

🚀 @chao_yan/bigfileuploader

一个支持 分片上传、大文件断点续传、并发控制、MD5 校验 的前端上传 SDK。
使用 TypeScript 编写,轻量、易扩展,适合二次封装到任意上传业务中。


✨ 特性

  • 分片上传:自动将大文件切割为小块上传
  • 🧩 并发控制:限制同时上传的请求数量,防止卡顿
  • 🧠 断点续传:支持中断后从已完成分片继续
  • 🔐 MD5 校验:计算文件唯一标识,用于秒传与分片校验
  • 🪶 轻量可扩展:无第三方 UI 依赖,可灵活集成到任意项目
  • 📦 TypeScript 支持:完整类型定义与开发体验

📦 安装

npm install @chao_yan/bigfileuploader
# 或使用 yarn
yarn add @chao_yan/bigfileuploader

📝 使用

import { FileUploader } from '@chao_yan/bigfileuploader'

const file = document.querySelector('input[type="file"]').files[0]
const uploader = new FileUploader(file, {
  url: 'http://localhost:3000/upload',
  chunkSize: 1024 * 1024 * 5, // 分片大小
  concurrent: 3, // 并发数
  retry: 3, // 重试次数

  // 上传前钩子
  beforeUpload: (file) => {
      
  }

📖 API

FileUploader

构造函数

constructor(file: File, options: FileUploaderOptions)

方法

start(): Promise<void> // 开始上传
pause(): void // 暂停上传
on(event: string, callback: Function): void // 监听事件

事件

on('start', callback: Function) // 上传开始
on('progress', callback: Function) // 上传进度
on('success', callback: Function) // 上传成功
on('error', callback: Function) // 上传失败
on('complete', callback: Function) // 上传完成

配置项

interface FileUploaderOptions {
  url: string // 上传接口地址
  chunkSize: number // 分片大小
  concurrent: number // 并发数
  retry: number // 重试次数
  beforeUpload?: (file: File) => void // 上传前钩子
  afterUpload?: (file: File) => void // 上传后钩子
}

目录结构

file-upload-sdk/ ├── src/ │ ├── index.ts // 导出入口 │ ├── uploader.ts // 主类 FileUploader │ ├── utils/ │ │ ├── chunk.ts // 分片工具 │ │ ├── hash.ts // 文件hash │ │ ├── retry.ts // 重试机制 │ │ └── request.ts // 并发控制 ├── example/ │ └── demo.html // 测试页面 ├── package.json ├── tsconfig.json └── README.md


🧾 License | 开源许可

本项目基于 MIT License 开源许可协议发布。

Copyright (c) 2025 chao_yan

本软件及其文档可免费使用、复制、修改、合并、发布和分发,
前提是必须在所有副本中保留上述版权声明和本许可说明。

本软件按 “原样” 提供,作者 不承担任何责任或保证
使用者应自行承担因使用本软件所产生的风险。


📘 English Version

This project is licensed under the MIT License.

Copyright (c) 2025 chao_yan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

📄 查看完整许可证 →