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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ringbud

v1.0.18

Published

![version](https://img.shields.io/badge/version-1.1.0-blue) ![TypeScript](https://img.shields.io/badge/-TypeScript-blue) ![license](https://img.shields.io/badge/license-MIT-green) ![dependencies](https://img.shields.io/badge/dependencies-0-orange) ![packa

Downloads

17

Readme

RingBud: Zero-Dependency, High-Performance RingBuffer Library

version TypeScript license dependencies package size unpacked size

Table of Contents

Introduction

RingBud is a high-performance, TypeScript-based RingBuffer library engineered for efficient data storage and retrieval. The API is designed to be both user-friendly and versatile, allowing fine-grained control over buffer operations.

Installation

To install RingBud, you can use npm:

npm install ringbud

Or yarn:

yarn add ringbud

Features

  • Type-Safe: Fully written in TypeScript for robust type safety.
  • Memory-Efficient: Features like preallocation and clamping optimize memory usage.
  • Customizable: Adjustable frame size to fit diverse application requirements.
  • High-Speed Read/Write: Employs optimized algorithms for rapid data access.
  • Zero Dependencies: Completely standalone with no external dependencies.
  • Lightweight: A minuscule package footprint for efficient deployment.

New: Clamping

The library now includes a clamping feature, enabled by default. When clamping is enabled, the remaining bytes in the buffer are moved to the beginning after each read operation. This avoids the need for resizing the buffer for new data, thereby optimizing memory usage. The trade-off is that the buffer is copied upon each read operation.

Usage

Basic Usage

Here's a quick example to get started:

import { RingBufferF32 } from "ringbud";

const frameSize = 128;
const buffer = new RingBufferF32(frameSize);

// Write data into the buffer
const data = new Float32Array([1.1, 2.2, 3.3]);
buffer.write(data);

// Read data from the buffer
const readData = buffer.read();

Advanced Features

Drain all available data from the buffer:

const allData = buffer.drain();

Memory Management

Memory Preallocation

RingBud preallocates memory based on your specified frame size, offering significant performance benefits by reducing the overhead of dynamic memory allocation.

Clamping for Large Buffers

With the new clamping feature, RingBud can handle large buffers efficiently without resizing the memory, albeit at the cost of copying the buffer during each read operation.

Extensibility with Typed Arrays

RingBud supports a broad spectrum of Typed Arrays, including Float32Array, Int16Array, Int32Array, Uint8Array, Uint16Array, Uint32Array, and Uint8ClampedArray, providing unparalleled flexibility for different data storage needs.

Zero Dependencies

The library is self-contained and does not rely on any external dependencies, making it highly portable and easy to integrate.

Package Size

  • Package size: 8.2 kB
  • Unpacked size: 36.5 kB
  • Total files: 40

License

RingBud is licensed under the MIT License. For more details, see the LICENSE file.