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

buffered-clone

v0.8.3

Published

A structured clone equivalent able to encode and decode as a buffer

Downloads

21

Readme

buffered-clone

Coverage Status

Social Media Photo by marc belver colomer on Unsplash

A structuredClone like utility that converts all supported JS types, plus ImageData, into a binary format.

Highlights

  • recursive out of the box for almost anything that can be serialized
  • once hot, it's nearly as fast as native structuredClone
  • it allows filling pre-allocated buffers and SharedArrayBuffer
  • it allows growing buffers if resizable
  • supports toJSON (already) and MessagePack extensions like mechanism (coming soon)

API

import BufferedClone from 'buffered-clone';

const { encode, decode } = new BufferedClone({
  // it's feature detected at runtime, don't change it
  // unless you know what you are doing.
  littleEndian: true,
  // by default makes references and strings encoded once
  circular: true,
  // if a view has already reserved buffer size,
  // this can be used to offset the encoding
  byteOffset: 0,
  // either the initial buffer length, when not provided,
  // or the amount of RAM to ask per each resize on top
  // of the new required size (incremental grow): the smaller
  // this value is, the least RAM is used but the slowest
  // serialization happens while encoding (due multiple resizes)
  byteLength: 0x1000000,
  // forces usage of Float 32 numbers instead of
  // the JS default which is Float 64
  useFloat32: false,
  // encodes strings directly as UTF16 without
  // needing any UTF16 to UTF8 conversion.
  // it is usually faster than UTF8 encode + view.set(...)
  // and it can deal with SharedArrayBuffer or resizable
  // ArrayBuffer without throwing, ideal for encodeInto case
  useUTF16: false,
  // mirrors common known strings or values
  // across worlds: it must be a precise list
  mirrored: [],
  // it can be a growable SharedArrayBuffer
  // or a resizable ArrayBuffer
  // or just nothing, defaulting to:
  buffer: new ArrayBuffer(0x1000000)
});

// returns a Uint8Array of the serialized data
encode(anyCompatibleValue);


// encodes *into* the currently available buffer
encode(anyCompatibleValue, true);
// encodes *into* a different buffer (discards the previous)
encode(anyCompatibleValue, specificBuffer);

// returns any compatible value that was serialized
decode(ui8a);