Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 647 Bytes

30-04-2019-generate-random-uuid.md

File metadata and controls

31 lines (20 loc) · 647 Bytes

notes on generating uuid - draft

from https://github.com/felixge/node-formidable/pull/488/files

const buf = crypto.randomBytes(16);
buf.toString('hex');

from nodejs.org/api/crypto

BBC dyalogeer

uuid.js

// from https://github.com/bbc/dialogger/blob/c589a32a450d201cc2f67be1466816e029df33c5/helpers/uuid.js
var crypto = require('crypto');
module.exports = function(cb) {
  crypto.pseudoRandomBytes(16, function (err, raw) {
    cb(err, err ? undefined : raw.toString('hex'))
  });
}

Cuid lib

https://www.npmjs.com/package/cuid