Able to load and understand a database

pull/2/head
Louis Chatriot 12 years ago
parent 4c4d55f541
commit 1c04a3874c
  1. 14
      lib/customUtils.js

@ -1,4 +1,5 @@
var fs = require('fs') var fs = require('fs')
, crypto = require('crypto')
; ;
@ -19,4 +20,17 @@ function ensureDirectoryExists (dir, cb) {
} }
/**
* Return a random string of length len
*/
function uid (len) {
return crypto.randomBytes(Math.ceil(len * 3 / 4))
.toString('base64')
.slice(0, len);
}
console.log(uid(5));
module.exports.ensureDirectoryExists = ensureDirectoryExists; module.exports.ensureDirectoryExists = ensureDirectoryExists;
module.exports.uid = uid;

Loading…
Cancel
Save