Skip to content

Instantly share code, notes, and snippets.

@dsdstudio
Created December 30, 2013 03:19
Show Gist options
  • Select an option

  • Save dsdstudio/8177397 to your computer and use it in GitHub Desktop.

Select an option

Save dsdstudio/8177397 to your computer and use it in GitHub Desktop.
Nodejs buffer -> java network tcp communication nodejs buffer 4byte int write
var buf = new Buffer(4);
var num = 171;
buf.writeInt32BE(num, 0);
console.log(buf); // 00 00 00 ab
buf.writeInt32LE(num, 0);
console.log(buf); // ab 00 00 00
@dsdstudio

dsdstudio commented Jun 22, 2016

Copy link
Copy Markdown
Author

difference for Big Endian and Little Endian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment