random-stringinizer
Version:
Generate Random Crypto String with ease!
67 lines (44 loc) • 1.39 kB
Markdown
Generate random crypto strings with ease, no fuss!
```js
let randomstring = require('random-stringinizer')
let string = randomstring({len:21, char:"ABCDSWIOUP"})
console.log(string);
```
**or**
```js
let randomstring = require('random-stringinizer');
let string = randomstring({len:20, typeOf:"ascii"});
/*
Other types further discussed about below
Note: You cannot use the char(character) parameter with typeOf parameter.
*/
console.log(string);
```
**len**
*required*
Specify the length of the string.
**typeOf**
*optional, default: hexadecimal*
Specify the typeOf string.
`url` -> For url-safe character string.
`hexadecimal` -> For hexadecimal string.
`base64` -> For base64 type string.
`distinct` -> For distinct characters string i.e., each different from the other.
`alphanumeric` -> Numeric characters mixed with alphabets.
`numeric` -> For numeric type string.
`ascii` -> For ascii printable strings.
**char**
Specify the characters that have to be randomized
example
```js
const randomstring = require('random-stringinizer');
const string = randomstring({len:10, char:"ANW129220348YR"})
console.log(string);
```
*Remember you cannot use char and typeOf together must be either one or none.*
> [Callista](https://npmjs.org/package/callista)
> [Hive-db](https://npmjs.org/package/hive-db)