Create Node.js Buffers with integers


numeric-buffer is a tiny module for filling a Node.js Buffer with the binary representation of an integer. You can do this in 0.6.0 with buffer.writeUInt8, but not in 0.4.x.


npm install numeric-buffer


(function () {
  "use strict";
  var numericBuffer = require('numeric-buffer');
  var buf = numericBuffer(255);
  // buf is now a Buffer of length 1