buffster
v0.1.2
Published
A dead-simple wrapper for building and reading nodejs Buffers
Downloads
14
Readme
Buffster
A dead-simple wrapper for building and reading nodejs Buffer
s
Installation
pnpm i buffster
Usage
import { BufferBuilder, BufferWithPointer } from "buffster"
const c = new BufferBuilder()
// methods are fluent, but mutate the builder
c.uint8(6).string("hello", "utf8")
const buf = c.result()
console.log(buf) // <Buffer 06 68 65 6c 6c 6f>
const r = new BufferWithPointer(buf)
console.log(r.uint8()) // 6
console.log(r.string(r.remaining())) // hello
console.log(r.remaining()) // 0