Skip to content

Instantly share code, notes, and snippets.

@randallb
Created April 27, 2013 23:35
Show Gist options
  • Save randallb/5475192 to your computer and use it in GitHub Desktop.
Save randallb/5475192 to your computer and use it in GitHub Desktop.
var numberConv;
numberConv = function(x) {
var octet1, octet2, octet3, octet4;
octet1 = x % 256;
octet2 = Math.floor(x / 256);
octet3 = Math.floor(x / (256 * 256));
octet4 = Math.floor(x / (256 * 256 * 256));
return new Buffer([octet1, octet2, octet3, octet4]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment