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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
2.0.5258latest

Version History

VersionDownloads (Last 7 Days)Published
2.0.5258
2.0.40
2.0.32,577
2.0.20
2.0.10
2.0.00
1.1.127
1.1.0431,110
1.0.0608,527
0.1.00

Package Sidebar

Install

npm i uid-promise

Weekly Downloads

1,042,499

Version

2.0.5

License

MIT

Unpacked Size

7.85 kB

Total Files

19

Last publish

Collaborators

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