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

@digitalhelp.life/wasm-client

v1.0.0

Published

High-performance file upload WASM library with chunked upload, resumable upload, instant upload, and batch upload support

Downloads

69

Readme

Upload Client WASM Library

高性能文件上传 WASM 库,支持分片上传、断点续传、秒传等功能。

特性

  • 🚀 WASM 加速: 使用 Rust + WebAssembly 实现核心算法
  • 📦 分片上传: 支持大文件分片上传,可配置分片大小
  • 秒传功能: 文件哈希计算 + 服务端检测,秒级完成
  • 🔄 断点续传: 支持网络中断后继续上传
  • 📊 批量上传: 支持多文件并发上传,智能队列管理
  • 🎯 进度追踪: 实时上传进度、速度、剩余时间
  • 🔧 Web Worker: 后台处理,不阻塞 UI 线程
  • 💪 TypeScript: 完整类型定义
  • ⚛️ React 集成: 开箱即用的 React Hooks

架构

wasm/
├── rust/                  # Rust WASM 核心库
│   ├── src/
│   │   ├── lib.rs        # WASM 入口
│   │   ├── hasher.rs     # 文件哈希计算
│   │   └── chunker.rs    # 分片逻辑
│   └── Cargo.toml
├── worker/               # Web Worker
│   └── upload.worker.ts  # 上传管理器
├── sdk/                  # TypeScript SDK
│   ├── core/
│   │   ├── UploadClient.ts      # 客户端核心
│   │   ├── UploadTask.ts        # 上传任务
│   │   └── StateManager.ts      # 状态管理
│   ├── api/
│   │   └── client.ts            # API 封装
│   └── types/
│       └── index.ts             # 类型定义
├── hooks/                # React Hooks
│   ├── useUpload.ts      # 单文件上传
│   └── useUploadQueue.ts # 批量上传队列
├── examples/             # 示例代码
└── package.json

快速开始

安装

cd froentend/wasm
npm install

构建 WASM

# 安装 Rust 工具链
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown
cargo install wasm-pack

# 构建 WASM
npm run build:wasm

使用

import { useUpload } from '@/wasm/hooks/useUpload';

function UploadDemo() {
  const {
    upload,
    progress,
    status,
    cancel
  } = useUpload({
    baseURL: 'https://upload.example.com',
    token: 'your-jwt-token',
    onSuccess: (result) => {
      console.log('上传成功:', result);
    }
  });

  const handleFileChange = (e) => {
    const file = e.target.files[0];
    upload(file);
  };

  return (
    <div>
      <input type="file" onChange={handleFileChange} />
      <div>进度: {progress}%</div>
      <div>状态: {status}</div>
      <button onClick={cancel}>取消</button>
    </div>
  );
}

API 参考

详见 API 文档

性能

  • WASM 哈希计算速度:~800MB/s(SHA256)
  • 分片上传吞吐量:~100MB/s(取决于网络)
  • 内存占用:< 10MB(不含文件缓存)
  • 并发上传:支持最多 100 个任务

许可

MIT License