binarystream

Crates.iobinarystream
lib.rsbinarystream
version2.6.10
sourcesrc
created_at2023-11-21 21:25:22.89446
updated_at2024-08-16 18:43:13.671771
descriptionA simple binary stream for Node.js
homepage
repository
max_upload_size
id1044631
size2,912,278
Payton Kerby (PMK744)

documentation

README

@serenityjs/binarystream

Binarystream is a simple Rust package designed to simplify the streaming of binary data in Javascript and Typescript. While containing the super speeds of Rust, and the ecosystem of Javascript!

Example Usage

import { BinaryStream } from "@serenityjs/binarystream"

// Create a new stream without a given buffer.
const stream = new BinaryStream()

// Reading / Writing is allowed on the fly,
// which will automatically update the cursor offset depending on the type of call.
stream.writeUint8(255)
stream.writeString16("Hello, World!")

// Converting the stream to a buffer!
const buffer = stream.getBuffer()

// Create another stream based on our output buffer from the previous stream.
const output = new BinaryStream(buffer)

// Reading the data in order.
stream.readUint8() // Expected output: 255
stream.readString16() // Expected output: "Hello, World!"

Commit count: 0

cargo fmt