Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Last active May 5, 2023 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WietseWind/600273a6e7609238e099ba25b505a96f to your computer and use it in GitHub Desktop.
Save WietseWind/600273a6e7609238e099ba25b505a96f to your computer and use it in GitHub Desktop.
Hex <> Number <> UTF-8 in Node
// Uint32 max: 4294967295
// 1500474479
console.log(
parseInt(Buffer.from('Yolo', 'utf-8').toString('hex'), 16)
)
console.log(
Buffer.from(Number(1500474479).toString(16), 'hex').toString('utf-8')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment