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

file-chunkify

v1.0.4

Published

File Chunkify

Readme

file-chunkify

A lightweight file chunking utility for splitting and merging large files across different environments.

Features

  • Efficiently splits large files into smaller chunks.
  • Supports progressive chunk uploading.
  • Merges chunks back into a single file upon completion.
  • Compatible with various runtime environments.

Installation

Install via npm:

npm install file-chunkify

Usage

File Splitting

Use splitFile to break a large file into chunks before processing:

import { splitFile } from "file-chunkify";

const fileInput = document.querySelector("input[type='file']");
fileInput.addEventListener("change", async (event) => {
  const file = event.target.files[0];
  for await (const chunkInfo of splitFile({
    file,
    chunkSize: 5 * 1024 * 1024,
  })) {
    console.log("Processing chunk", chunkInfo);
    // Send chunkInfo.chunk to the storage or processing pipeline
  }
});

Chunk Storage & Merging

Use saveChunk to store received chunks and merge them when all are received:

import { saveChunk } from "file-chunkify";
import express from "express";
import multer from "multer";

const app = express();
const upload = multer();

app.post("/upload", upload.single("chunk"), async (req, res) => {
  const { chunkNumber, totalChunks } = req.body;
  const result = await saveChunk({
    file: req.file,
    chunkNumber: Number(chunkNumber),
    totalChunks: Number(totalChunks),
    options: { debugMode: true }, // Example usage of debugger
  });
  res.json(result);
});

app.listen(3000, () => console.log("Server running on port 3000"));

API Reference

splitFile(options)

Splits a file into chunks.

Parameters:

| Name | Type | Default | Description | | --------- | ------ | -------- | ------------------------------------- | | file | File | Required | The file to be split. | | chunkSize | number | 5MB | The size of each chunk. | | options | object | Optional | Additional options, including debugMode. |

Returns:

An async generator yielding objects with:

  • chunk: A file slice (File)
  • chunkNumber: The current chunk number
  • totalChunks: Total number of chunks
  • fileName: A generated UUID-based file name
  • progress: Split progress in %

saveChunk(options)

Saves uploaded chunks and merges them when all are received.

Parameters:

| Name | Type | Default | Description | | ----------- | ------------------- | ---------------- | ---------------------------------------- | | file | Express.Multer.File | Required | The uploaded chunk file. | | chunkNumber | number | Required | The current chunk number. | | totalChunks | number | Required | The total number of chunks. | | outputDir | string | ./uploads | Directory to store merged files. | | chunkDir | string | ./uploads/chunks | Directory to store chunk files. | | options | object | Optional | Additional options, including debugMode. |

Returns:

| Name | Type | Description | | -------------- | ------- | -------------------------------------------- | | success | boolean | Indicates if the operation was successful. | | message | string | A status message. | | mergedFilePath | string? | The path of the merged file (if applicable). |

License

MIT License © 2025 Ahmad Al-Zein