larvitutils
Misc utilities
Convert a buffer to an Uuid
var utils = require('larvitutils'),
uuid = utils.bufferToUuid(new Buffer('f9684592b24542fa88c69f16b9236ac3', 'hex'));
console.log(uuid);
Example usecase: fetch a binary column from a database and convert to a readable Uuid string
hrtimeToMs()
Used to convert hrtime() calls to milliseconds, since hrtime() output is messy (seconrds + nanoseconrds)
Usage:
var utils = require('larvitutils'),
startTime = process.hrtime();
setTimeout(function() {
console.log('benchmark took %d ms', utils.hrtimeToMs(startTime, 4));
}, 34);