Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created October 24, 2010 00:29
Show Gist options
  • Save isaacs/642889 to your computer and use it in GitHub Desktop.
Save isaacs/642889 to your computer and use it in GitHub Desktop.
var b = new Buffer(256*256)
for (var i = 0 ; i < 256*256 ; i ++) {
b[i] = i % 256
}
var s = b.toString("binary")
var b2 = new Buffer(s, "binary")
for (var i = 0 ; i < 256*256 ; i ++) {
if (b2[i] !== i) console.error("error at 0x"+i.toString(16))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment