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

@acuminous/bitsyntax

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acuminous/bitsyntax

Pattern-matching on byte buffers

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @acuminous/bitsyntax?

@acuminous/bitsyntax is an npm package that provides utilities for working with binary data using a syntax inspired by Erlang's bit syntax. It allows you to parse and construct binary data structures in a declarative manner.

What are @acuminous/bitsyntax's main functionalities?

Parsing binary data

This feature allows you to parse binary data according to a specified pattern. In this example, the pattern 'header:8, body:binary' is used to extract an 8-bit header and the remaining bytes as the body.

const bitsyntax = require('@acuminous/bitsyntax');

const pattern = bitsyntax.matcher('header:8, body:binary');
const buffer = Buffer.from([0x01, 0x02, 0x03, 0x04]);
const result = pattern(buffer);
console.log(result); // { header: 1, body: <Buffer 02 03 04> }

Constructing binary data

This feature allows you to construct binary data from a specified pattern and values. In this example, the pattern 'header:8, body:binary' is used to create a buffer with the given header and body.

const bitsyntax = require('@acuminous/bitsyntax');

const pattern = bitsyntax.builder('header:8, body:binary');
const buffer = pattern({ header: 1, body: Buffer.from([0x02, 0x03, 0x04]) });
console.log(buffer); // <Buffer 01 02 03 04>

Other packages similar to @acuminous/bitsyntax

FAQs

Package last updated on 01 Sep 2022

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