@hazae41/cursor
TypeScript icon, indicating that this package has built-in type declarations

1.2.3 • Public • Published

Cursor

npm i @hazae41/cursor

Node Package 📦

Features

Current features

  • 100% TypeScript and ESM
  • No external dependencies
  • Zero-copy reading and writing
  • Rust-like patterns
  • Unit-tested

Usage

Cursor

Writing

const cursor = Cursor.allocUnsafe(1024)

cursor.tryWriteUint8(123).unwrap()
cursor.tryWriteUint16(1234).unwrap()

console.log(cursor.offset) // 3

Reading

const bytes = new Uint8Array(/*...*/)
const cursor = new Cursor(bytes)

const uint8 = cursor.tryReadUint8().unwrap()
const uint16 = cursor.tryReadUint16().unwrap()

console.log(cursor.offset) // 3

Package Sidebar

Install

npm i @hazae41/cursor

Weekly Downloads

3

Version

1.2.3

License

MIT

Unpacked Size

159 kB

Total Files

33

Last publish

Collaborators

  • hazae41