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

fastcdc

v1.0.1

Published

NodeJS bindings for fastcdc-rs

Downloads

893

Readme

fastcdc

fastcdc: NodeJS bindings for @nlfielder's fastcdc-rs package.

This module implements the fast content defined chunking algorithm (FastCDC) described in the following paper:

W. Xia et al. "FastCDC: a Fast and Efficient Content-Defined Chunking Approach for Data Deduplication" Usenix 2016

Content defined chunking takes a blob of bytes (like a file for example) and cuts it into more or less uniform sized chunks along content boundaries. Because these chunk boundaries are determined by the contents of a file, not regular intervals they are robust to local modifications like insertions and deletions. This makes content defined chunking useful when deduplicating date, comparing files and synchronizing files over remote network storage.

Example

const fastCDC = require('./index.js')

const buffer = new Uint8Array(10 * 1024)
for (let i = 0; i < buffer.length; ++i) {
    buffer[i] = Math.random() * 256
}

console.log(fastCDC(buffer, {
    min: 1024,
    avg: 4096,
    max: 65536
}))

Output

[ 0, 2594, 6454, 8106, 9244, 10240 ]

Install

If your system has an up-to-date build of nodejs and rust you should be able to install this package using

npm install fastcdc

API

require('fastcdc')(bytes:ArrayBuffer|Uint8Array, opts?)

Computes a list of content defined chunk boundaries using fastcdc-rs.

Arguments

  • bytes is either an ArrayBuffer or a Uint8Array containing the bytes to be hashed
  • opts is a set of optional arguments to the chunker. If it is a number, then it assumed to be the average chunk size in bytes (default is 1024). Otherwise, if an object is passed then it is assumed to be a configuration with the following properties:
    • min the minimum chunk size
    • avg the average chunk size
    • max the maximum chunk size

Returns An array of chunk boundaries (0 and bytes.length inclusive) representing the chunks of the file

License

(c) 2021 Mikola Lysenko. ISC License