Last active
May 5, 2023 12:24
-
-
Save WietseWind/600273a6e7609238e099ba25b505a96f to your computer and use it in GitHub Desktop.
Hex <> Number <> UTF-8 in Node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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