From 7f2802fac877611d1558ae117003b84f14972f5f Mon Sep 17 00:00:00 2001 From: s2 Date: Wed, 22 Apr 2015 23:54:36 +0200 Subject: [PATCH] add urlsafe parameter --- README.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 509faec..85076e0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,33 @@ # securerandomstring a node module that generates a secure random string with a given length -## usage -see `tests.js` +## Usage +`require` it + +``` +var securerandomstring = require('securerandomstring'); +``` + + +generate a random string that is 32 chars long (the default) +``` +securerandomstring(function(sr) { + console.log(sr); +}); +``` + + +generate a random string that is 256 chars long +``` +securerandomstring({length: 256}, function(sr) { + console.log(sr); +}); +``` + + +generate a random string that is 20 chars long and is url safe (can be used as a url token) +``` +securerandomstring({length: 20, urlsafe: true}, function(sr) { + console.log(sr); +}); +```