Last active
December 20, 2016 08:30
-
-
Save huawww/ea1de878649f2031fdde76eb4b8bff3f to your computer and use it in GitHub Desktop.
ascii2str
This file contains hidden or 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
//nodejs v6.4.0 | |
console.log("Hello, World!"); | |
var s = 's'; | |
var charCode = s.charCodeAt(0); | |
console.log(charCode); | |
var buf = Buffer.from([charCode], 'ascii'); | |
console.log(buf.toString()); | |
var y = '2122234041424344457B7C7D7E7F'; | |
var bufHex = Buffer.allocUnsafe(0); | |
bufHex = Buffer.concat([bufHex, Buffer.from(y, 'hex')]); | |
console.log(bufHex, bufHex.toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment