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

bufrw

Package Overview
Dependencies
Maintainers
11
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bufrw

Buffer Reading and Writing

  • 1.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
496K
decreased by-3.28%
Maintainers
11
Weekly downloads
 
Created

What is bufrw?

The 'bufrw' npm package is a buffer read/write library designed to facilitate the reading and writing of binary data. It provides a set of tools to handle binary data serialization and deserialization, making it easier to work with binary protocols.

What are bufrw's main functionalities?

Buffer Reading

This feature allows you to read binary data from a buffer. In this example, a 32-bit unsigned integer is read from a buffer in big-endian format.

const bufrw = require('bufrw');
const buffer = Buffer.from([0x01, 0x02, 0x03, 0x04]);
const result = bufrw.UInt32BE.readFrom(buffer, 0);
console.log(result.value); // 16909060

Buffer Writing

This feature allows you to write binary data into a buffer. In this example, a 32-bit unsigned integer is written into a buffer in big-endian format.

const bufrw = require('bufrw');
const buffer = Buffer.alloc(4);
bufrw.UInt32BE.writeInto(16909060, buffer, 0);
console.log(buffer); // <Buffer 01 02 03 04>

Custom Serialization

This feature allows you to define custom serialization structures. In this example, a structure consisting of an 8-bit unsigned integer followed by a 16-bit unsigned integer in big-endian format is defined and written into a buffer.

const bufrw = require('bufrw');
const MyStruct = bufrw.Struct([bufrw.UInt8, bufrw.UInt16BE]);
const buffer = Buffer.alloc(3);
MyStruct.writeInto([0x01, 0x0203], buffer, 0);
console.log(buffer); // <Buffer 01 02 03>

Other packages similar to bufrw

FAQs

Package last updated on 26 Oct 2023

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