Skip to content

Instantly share code, notes, and snippets.

@JosePedroDias
Created July 30, 2014 18:11
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 JosePedroDias/6022713b120ecc44551a to your computer and use it in GitHub Desktop.
Save JosePedroDias/6022713b120ecc44551a to your computer and use it in GitHub Desktop.
print buffer as hex string
var i, w, res = [];
for (i = 0; i < b.length; ++i ) {
w = b[i];
res.push( w.toString(16) );
if (i % 2 !== 0) {
res.push(' ');
}
}
console.log( res.join('') );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment