uid-promise
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

uid-promise

Creates a cryptographically secure UID with a 62 character range that can be safely used in URLs.

Usage

Install the package:

npm i uid-promise

Then import it:

import { uid } = from 'uid-promise';

Finally, call it:

await uid(20);

API

uid(Number len) => Promise

  • Return a Promise that resolves with a string of random characters of length len
  • len must always be provided, else the promise is rejected
  • Under the hood, crypto.randomBytes is used
  • Character set: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

Authors

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i uid-promise

    Weekly Downloads

    527,761

    Version

    2.0.5

    License

    MIT

    Unpacked Size

    7.85 kB

    Total Files

    19

    Last publish

    Collaborators

    • gdborton
    • matheuss
    • matt.straka
    • nick.tracey
    • zeit-bot
    • vercel-release-bot