Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created November 30, 2022 21:42
Show Gist options
  • Save miguelmota/c45e58c5a116539b8eaa2b07e1646cb6 to your computer and use it in GitHub Desktop.
Save miguelmota/c45e58c5a116539b8eaa2b07e1646cb6 to your computer and use it in GitHub Desktop.
Node.js 64-bit buffer example
const buf = Buffer.alloc(8)
const view = new DataView(buf.buffer)
view.setBigInt64(0, BigInt(100), false) // true when little endian
console.log(buf.toString('hex')) // "0000000000000064"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment