1.3.0 • Published 11 months ago

randomstring v1.3.0

Weekly downloads
313,362
License
MIT
Repository
github
Last release
11 months ago

node-randomstring

Build Status Download Stats

Library to help you create random strings.

Installation

To install randomstring, use npm:

npm install randomstring

Usage

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)
    • options
      • length - the length of the random string. (default: 32) OPTIONAL
      • readable - exclude poorly readable chars: 0OIl. (default: false) OPTIONAL
      • charset - define the character set for the string. (default: 'alphanumeric') OPTIONAL
      • capitalization - define whether the output should be lowercase / uppercase only. (default: null) OPTIONAL
        • lowercase
        • uppercase
    • cb - Optional. If provided uses async version of crypto.randombytes

Command Line Usage

$ npm install -g randomstring

$ randomstring
> sKCx49VgtHZ59bJOTLcU0Gr06ogUnDJi

$ randomstring 7
> CpMg433

$ randomstring length=24 charset=github readable
> hthbtgiguihgbuttuutubugg

Tests

npm install
npm test

LICENSE

node-randomstring is licensed under the MIT license.

xanthuscore@haluka/coreconsole_data_apidapid-identity-ethereum@balena/jellyfish-sync@balena/open-balena-api@balena/pinejs@balena/jellyfish-plugin-balena-api@elianrichard/react-authnodejs-jwt-authorizationserver-cloner.jsui_automation_dd_ccrge-carpool-data-model@sfast/mongomanager@obkenobi/indyclienthindykey_management_service@beyondcoin/beyondasset-block-explorer4leaflabs-api-proxysyzoj-sandboxapril-taxi-booking-poc-data-modelconnect-transactions-apireal-test-dirwebdriverio-typescript-dockertn-illuminateworkspace-webdriveriovtex3web-deployhaluka-coreagile-director-backzipwire-nodenodetunes-zpvueteor-clientvueteor-serveraccount-genadonis5-kueian-serveracr-coremojaloop-fxp-scheme-adapterexpress-typescript-mongoose-starternode-link-shortneridentity-namespace-serviceegg-poppy-api-frameworkboilerplate-hapijs@rili/netlify-cms-oauth-provider-nodeokitchencutnut-servercaccl-kevinaccoders-sandbox@af_selim/spot@lqh1993/node-wechatcopyfactory-sdkgioxxy-metaapi-sdk@flyeralarmdigital/fad-authenticationfull-auth@lexagr-puppeteer-extra/puppeteer-extra-plugin-devtools@lexagr/puppeteer-extra-plugin-devtoolshyperyatah2pcli@aidenhadisi/dank-twitch-irc@yarvis/images@pf126/common@project-furnace/furnace-cli@equippedcoding/appfactoryclassroom-module-apisodashrugo-filesystemrugo-mongodbdatocms-plugin-auto-iddatocms-plugin-auto-uidetb-icicimoongarmjs-clibolto-file-uploadbolto-uploadify@sfanta/prisma-helper@sfanta/sodash2@felvin-search-apps/random-string-generatorkingcache@yippiecloud/cdk-appsync-stackuri-cc-modelssecureaccount@loophole-labs/parasiteeyezonpdxdeploy-v3.1.3chui-electronddm-clicroket_mainfrodo-downloadernx-angular@collaveinc/workbench-serverreact-ts-form-gen-elements@infinitebrahmanuniverse/nolb-randomsmetakey-libhuskyuncle220302react-mui-form-generatortestingh2pclirxjs-cumulustelekom-adapterthebackend_authorization_apithebackend_game_auth_api
1.3.0

11 months ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.5

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.0

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

10 years ago

1.0.2

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago