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

b4a

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

b4a

Bridging the gap between buffers and typed arrays

  • 1.6.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.3M
decreased by-0.31%
Maintainers
2
Weekly downloads
 
Created

What is b4a?

The b4a npm package is a Buffer implementation for the browser with the same API as the Node.js Buffer. It allows you to use the Buffer API in environments where the native Buffer is not available, such as in web browsers.

What are b4a's main functionalities?

Buffer Creation

This feature allows you to create a new Buffer instance from a string, with an optional encoding parameter.

const b4a = require('b4a');
const buf = b4a.from('hello world', 'utf8');

Buffer Concatenation

This feature allows you to concatenate multiple Buffer instances into a new Buffer instance.

const b4a = require('b4a');
const buf1 = b4a.from('hello');
const buf2 = b4a.from('world');
const buf3 = b4a.concat([buf1, buf2]);

Buffer Allocation

This feature allows you to allocate a new Buffer with a specified size, which is filled with zeros by default.

const b4a = require('b4a');
const buf = b4a.alloc(10); // allocates a new Buffer of 10 bytes

Buffer Conversion

This feature allows you to convert data between Buffers and strings with different encodings.

const b4a = require('b4a');
const buf = b4a.from('7468697320697320612074c3a97374', 'hex');
const str = buf.toString('utf8');

Other packages similar to b4a

FAQs

Package last updated on 25 Sep 2024

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