0.1.2 • Published 5 years ago

buffster v0.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

Buffster

A dead-simple wrapper for building and reading nodejs Buffers

NPM

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