Created
October 31, 2018 03:15
-
-
Save tristanperalta/ff545571f43681c57dacd1da528d329c to your computer and use it in GitHub Desktop.
convert utf-8 string to hex string
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
function toHex(str) { | |
return Buffer.from(str, 'utf-8').toString('hex'); | |
} | |
console.log(toHex('tristan')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment