Skip to content

codingpains/crispy-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crispy String

Build Status

A simple tool that creates random base 10, 16, 32, 62 and 64 strings. Very useful to give random ids to objects or to give a unique filename to any uploaded file when you just want it to be unique and sanitized.

Installing.

 npm install crispy-string

Basic example.

Creating a string with just decimals and a length of 8 characters is as simple as:

  var crispy = require('crispy-string');

  crispy.base10String(8);

Methods.

base10String(length)

Creates a random decimal string

Character pool: Digits

  crispy.base10String(8); // => '98145208'

base16String(length)

Creates a random hexadecimal string

Character pool: Digits, Uppercase A to F

  crispy.base16String(8); // => 'A81FB209'

base32String(length)

Creates a random base 32 string:

Character pool: Digits, Uppercase A to Z

  crispy.base32String(8); // => 'a81Fb2cz'

base62String(length)

Creates a random base 62 string

Character pool: Digits, Uppercase A to Z and Lowercase a to z

  crispy.base62String(8); // => 'ab82dE0X'

base64String(length)

Creates a random base 64 string

Character pool: Digits, Uppercase A to Z, Lowercase a to z, + and /

  crispy.base64String(8); // => 'x8/dFB0+'

About

Tool to create random string with a specific baseN charset.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published