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

@yuhere/js-buffer

v2.1.18

Published

Node.js Buffer API, for the browser

Readme

@yuhere/js-buffer

Forked from feross/buffer — rewritten in TypeScript with modern ESM tooling.

npm downloads npm coverage

The buffer module from Node.js, for the browser — backed by Uint8Array.


Fork notice

This is a TypeScript port of feross/buffer by Feross Aboukhadijeh.

Key changes from the original:

  • Rewritten in TypeScript with full type declarations
  • Build tooling migrated to Vite (Rollup-powered ESM output)
  • Test framework migrated from Mocha/Chai to Vitest
  • Published as @yuhere/js-buffer (ESM only)

Install

npm install @yuhere/js-buffer

Usage

import { Buffer } from '@yuhere/js-buffer'

const buf = new Buffer('hello', 'utf8')
console.log(buf.toString('hex'))   // 68656c6c6f
console.log(buf.toString('base64')) // aGVsbG8=

API

The API is 100% identical to Node.js's Buffer API. Read the official Node.js docs for the full list of supported methods.

Features

  • Backed by Typed Arrays (Uint8Array / ArrayBuffer) — fast and memory-efficient
  • Preserves Node.js Buffer API exactly
  • .slice() returns instances of the same type (Buffer)
  • Square-bracket buf[4] notation works everywhere
  • Does not modify any browser prototypes

Important differences

Always use Buffer.isBuffer, not instanceof Buffer

The Buffer constructor returns an augmented Uint8Array for performance, so instanceof Buffer won't work. Always use Buffer.isBuffer(b) to check.

buf.slice() and shared memory

In Node.js, slice() creates a new Buffer that shares memory with the original. This works correctly in modern browsers with typed array support. Very old browsers (Firefox < 30) use an alternate Object-based implementation where slices don't share memory.

How it works

Buffer extends Uint8Array, adding all Node.js Buffer methods as properties on each instance. This gives us square-bracket indexing and fast typed-array operations without touching Uint8Array.prototype.

Development

npm install
npm test              # Run Node tests
npm run test:browser  # Run browser tests (Playwright)
npm run test:coverage # Combined Node + Browser coverage
npm run build         # Build ESM output to lib/

License

MIT. Copyright (C) Feross Aboukhadijeh, and other contributors. Originally forked from an MIT-licensed module by Romain Beauxis.