Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sparse-bitfield

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparse-bitfield

Bitfield that allocates a series of small buffers to support sparse bits without allocating a massive buffer

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.9M
decreased by-7.8%
Maintainers
1
Weekly downloads
 
Created

What is sparse-bitfield?

The sparse-bitfield package is a utility for efficiently storing and manipulating sparse bitfields. It is particularly useful for scenarios where you need to handle large arrays of boolean values or bits, but expect many of these values to be false or unset, thus allowing for memory-efficient storage and operations.

What are sparse-bitfield's main functionalities?

Allocation and setting bits

This feature allows for the allocation of a new bitfield and setting specific bits to true or false. It is useful for initializing and modifying bitfields.

const Bitfield = require('sparse-bitfield');
const bitfield = new Bitfield();
bitfield.set(100, true); // Sets the bit at position 100 to true

Getting bit values

This feature enables retrieving the value of a specific bit in the bitfield. It's useful for checking the state of bits.

const value = bitfield.get(100); // Retrieves the value at position 100, returns true if set, false otherwise

Memory efficiency

This feature provides information on the memory usage of the bitfield, highlighting the package's efficiency in handling sparse data.

const memoryUsage = bitfield.memoryUsage(); // Returns the amount of memory used by the bitfield

Other packages similar to sparse-bitfield

FAQs

Package last updated on 05 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc