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

bytebuf

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytebuf

A byte buffer for encoding and decoding binary data.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bytebuf

npm David

A byte buffer for encoding and decoding binary data in JavaScript. Supports the major web browsers, NodeJS, Deno, and Cloudflare Workers.

Install

npm i bytebuf

Usage

import { ByteBuf } from "bytebuf"

const data = new Uint8Array(1024)
const buffer = ByteBuf.from(data)

buffer.writeInt32(16)
buffer.writeString("Encoding is fun!")
buffer.setInt16(4, 25924, true)
buffer.writeVarInt(49)

console.log(buffer.byteOffset) // 21
buffer.reset()

const byteLength = buffer.readInt32() // 16
console.log(buffer.readString(byteLength)) // "Decoding is fun!"
console.log(buffer.getVarInt(20)) // { value: 49, byteLength: 1 }

Keywords

FAQs

Package last updated on 16 Sep 2021

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