1.3.1 • Published 10 months ago
randomstring v1.3.1
node-randomstring
Library to help you create random strings.
Installation
To install randomstring, use npm:
npm install randomstringUsage
var randomstring = require("randomstring");
randomstring.generate();
// >> "XwPp9xazJ0ku5CZnlmgAx2Dld8SHkAeT"
randomstring.generate(7);
// >> "xqm5wXX"
randomstring.generate({
length: 12,
charset: 'alphabetic'
});
// >> "AqoTIzKurxJi"
randomstring.generate({
charset: 'abc'
});
// >> "accbaabbbbcccbccccaacacbbcbbcbbc"
randomstring.generate({
charset: ['numeric', '!']
});
// >> "145132!87663611567!2486211!07856"
randomstring.generate({
charset: 'abc'
}, cb);
// >> "cb(generatedString) {}"API
randomstring.
generate(options, cb)optionslength- 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) OPTIONALlowercaseuppercase
cb- Optional. If provided uses async version ofcrypto.randombytes
Command Line Usage
$ npm install -g randomstring
$ randomstring
> sKCx49VgtHZ59bJOTLcU0Gr06ogUnDJi
$ randomstring 7
> CpMg433
$ randomstring length=24 charset=github readable
> hthbtgiguihgbuttuutubuggTests
npm install
npm testLICENSE
node-randomstring is licensed under the MIT license.
1.3.1
10 months ago
1.3.0
2 years ago
1.2.3
3 years ago
1.2.2
4 years ago
1.2.0
5 years ago
1.2.1
5 years ago
1.1.5
10 years ago
1.1.4
10 years ago
1.1.3
10 years ago
1.1.2
10 years ago
1.1.0
10 years ago
1.0.8
10 years ago
1.0.7
10 years ago
1.0.6
10 years ago
1.0.5
11 years ago
1.0.4
11 years ago
1.0.3
12 years ago
1.0.2
13 years ago
1.0.1
14 years ago
1.0.0
14 years ago