Skip to content

Latest commit

 

History

History
24 lines (16 loc) · 543 Bytes

README.md

File metadata and controls

24 lines (16 loc) · 543 Bytes

Binary Reader

A binary reader package to read binary data.

Add Package

deno add jsr:@typescriptplayground/binary-reader

Usage

import {BinaryReader} from "@typescriptplayground/binary-reader";

const dataToRead = new Uint8Array([1,2,3,4])

const reader = new BinaryReader(dataToRead.buffer);

console.log(reader.read(2)) // ArrayBuffer { [Uint8Contents]: <01 02>, byteLength: 2 }

console.log(reader.bufferLeft.byteLength) // 2

console.log(reader.readInt16()) // 772

console.log(reader.bufferLeft.byteLength) // 0