1.0.2 • Published 3 years ago
randomix v1.0.2
node-randomix | Mert Arguc
Library to help you create random strings.
Installation
To install randomix, use npm:
npm install randomix
Usage
var randomix = require("randomix");
randomix.generate();
// >> "XwPp9xazJ0ku5CZnlmgAx2Dld8SHkAeT"
randomix.generate(7);
// >> "xqm5wXX"
randomix.generate({
length: 12,
charset: 'alphabetic'
});
// >> "AqoTIzKurxJi"
randomix.generate({
charset: 'abc'
});
// >> "accbaabbbbcccbccccaacacbbcbbcbbc"
randomix.generate({
charset: 'abc'
}, cb);
// >> "cb(generatedString) {}"
API
randomix.
generate(options, cb)
options
length
- the length of the random string. (default: 32) OPTIONALreadable
- exclude poorly readable chars: 0OIl. (default: false) OPTIONALcharset
- define the character set for the string. (default: 'alphanumeric') OPTIONALcapitalization
- define whether the output should be lowercase / uppercase only. (default: null) OPTIONALlowercase
uppercase
cb
- Optional. If provided uses async version ofcrypto.randombytes
Command Line Usage
$ npm install -g randomix
$ randomix
> sKCx49VgtHZ59bJOTLcU0Gr06ogUnDJi
$ randomix 7
> CpMg433
$ randomix length=24 charset=github readable
> hthbtgiguihgbuttuutubugg
Tests
npm install
npm test
LICENSE
node-randomix is licensed under the MIT license.