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

resumable-uploads

v1.0.0

Published

A JavaScript library for providing multiple simultaneous, stable, fault-tolerant and resumable/restartable uploads via the HTML5 File API that supports typescript.

Readme

resumable-uploads

npm version CI codecov License: MIT npm downloads

A modern, TypeScript-supported JavaScript library for providing multiple simultaneous, stable, fault-tolerant, and resumable/restartable file uploads via the HTML5 File API.

This project is a maintained fork of the original resumable.js, which hasn't been updated since 2018. We've modernized the codebase, fixed long-standing bugs, added TypeScript support, and continue to maintain it for the community.

Features

  • Resumable Uploads: Automatically resume uploads after network interruptions
  • Chunked Uploads: Split large files into small chunks for reliable transfer
  • Fault Tolerance: Retry failed chunks automatically with configurable retry logic
  • Multiple Simultaneous Uploads: Upload multiple files at once
  • TypeScript Support: Full TypeScript definitions included
  • Drag & Drop: Built-in support for drag-and-drop file selection
  • Progress Tracking: Monitor upload progress for individual files and overall
  • File Validation: Validate file types, sizes, and more before uploading
  • Browser Compatibility: Works in Firefox 4+, Chrome 11+, Safari 6+, and IE 10+
  • No Dependencies: Pure JavaScript with no external dependencies

Installation

npm

npm install resumable-uploads

yarn

yarn add resumable-uploads

Quick Start

Basic Usage

// Create a new Resumable instance
const resumable = new Resumable({
  target: "/api/upload",
  chunkSize: 1 * 1024 * 1024, // 1MB chunks
  simultaneousUploads: 3,
  testChunks: true,
  throttleProgressCallbacks: 1,
});

// Check if browser is supported. If the browser does not support html 5 uploads then I don't know what to tell ya
if (!resumable.support) {
  alert("Your browser does not support HTML5 file uploads!");
}

// Assign browse button
resumable.assignBrowse(document.getElementById("browseButton"));

// Assign drop target
resumable.assignDrop(document.getElementById("dropArea"));

// Listen to events
resumable.on("fileAdded", function (file, event) {
  console.log("File added:", file.fileName);
  resumable.upload(); // Start upload
});

resumable.on("fileSuccess", function (file, message) {
  console.log("File uploaded successfully:", file.fileName);
});

resumable.on("fileError", function (file, message) {
  console.error("Upload error:", message);
});

resumable.on("progress", function () {
  console.log("Upload progress:", Math.floor(resumable.progress() * 100) + "%");
});

HTML Setup

<!doctype html>
<html>
  <head>
    <title>Resumable Upload Example</title>
  </head>
  <body>
    <div id="dropArea" style="border: 2px dashed #ccc; padding: 50px; text-align: center;">
      Drop files here or <button id="browseButton">Browse</button>
    </div>

    <div id="progress" style="margin-top: 20px;">
      <div id="progressBar" style="width: 0%; height: 20px; background: #4CAF50;"></div>
    </div>

    <script src="resumable-uploads.js"></script>
    <script src="app.js"></script>
  </body>
</html>

TypeScript

import Resumable from "resumable-uploads";

const resumable = new Resumable({
  target: "/api/upload",
  chunkSize: 1 * 1024 * 1024,
  simultaneousUploads: 3,
});

resumable.on("fileAdded", (file: any, event: Event) => {
  console.log("File added:", file.fileName);
  resumable.upload();
});

Server-Side Implementation

Files are uploaded in "chunks". This allows us to retry individual chunks if an issue occurs instead of reuploading the entire file. This is also beneficial when an auth token needs to be refreshed after a certain amount of time and a file can not be reliably streamed. Your server needs to handle chunked uploads. Here's a basic example:

Node.js/Express Example

app.post("/api/upload", (req, res) => {
  const chunkNumber = req.body.resumableChunkNumber;
  const totalChunks = req.body.resumableTotalChunks;
  const identifier = req.body.resumableIdentifier;

  // Save chunk to temporary location
  // When all chunks received, reassemble the file

  res.status(200).send("Chunk uploaded");
});

app.get("/api/upload", (req, res) => {
  const chunkNumber = req.query.resumableChunkNumber;
  const identifier = req.query.resumableIdentifier;

  // Check if chunk exists
  if (chunkExists(identifier, chunkNumber)) {
    res.status(200).send("Chunk exists");
  } else {
    res.status(204).send("Chunk not found");
  }
});

Documentation

For comprehensive documentation including all configuration options, events, methods, and advanced usage, see DOCUMENTATION.md.

Browser Compatibility

| Browser | Minimum Version | | ------- | --------------- | | Chrome | 11+ | | Firefox | 4+ | | Safari | 6+ | | Edge | All versions | | IE | 10+ | | Opera | 12+ |

Examples

Check out the examples directory for complete working examples including:

  • Basic single file upload
  • Multiple file uploads with queue management
  • Drag and drop interface
  • Retry logic and error handling

Contributing

We welcome contributions! Please see our CONTRIBUTING.md for guidelines and requirements on how to contribute to this project. All contributors are expected to follow our Code of Conduct.

Support

Changelog

See CHANGELOG.md for a list of changes in each version.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This project is a fork of resumable.js by Bjørn Åge Tungesvik. We're grateful for the original work and continue to maintain and improve it for the community.

Contributors

Thanks to all the contributors who have helped make this project better!