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

@4bitlabs/vector

v1.1.0

Published

A simple, TypedArray-backed resizable vector data-structure for ints, floats, and bigints

Readme

@4bitlabs/vector

License NPM Version NPM Downloads Ko-fi

A simple, TypedArray-backed resizable vector data-structure.

Installing

Using npm:

$ npm install --save @4bitlabs/vector

Documentation

Full documentation for the library can be found here

Usage

import { Vector } from '@4bitlabs/vector';

/* Create a resizable vector of float64s */
const floats = new Vector(Float64Array, { initialCapacity: 10 });
floats.push(Math.random());
console.log(floats.pop());

/* Create a resizable vector of bytes */
const bytes = new Vector(Uint8ClampedArray, { initialCapacity: 255 });
bytes.push(0x10);
console.log(bytes.pop());

Also included is BigVector for usage with int64 and uint64 sized integers:

import { BigVector } from '@4bitlabs/vector';

const uint64s = new BigVector(BigUint64Array);
uint64s.push(0xffff_ffff_ffff_ffffn);

Resize in-place

The default implementations of Vector and BigVector reallocated and copied the underlying ArrayBuffer on reallocate() and grow(). In certain use-cases, this could cause undesirable garbage-collection pressure. As of ES2024, support for in-place, resizable ArrayBuffer is widely available in both Node and browsers. To use this, provide a maximumCapacity when creating a Vector or BigVector.

import { Vector } from '@4bitlabs/vector';

const vec = new Vector(Uint8Array, { initialCapacity: 16, maximumCapcity: 1_024 });
vec.reallocate(1_024); // growing in-place
vec.reallocate(128); // shrinking in-place

Attempting to resize a Vector beyond its maximum capacity, either through adding values with push() and pushN() or explicit resizing, will throw an exception.

License

ISC