generates a cryptographically strong random uid
npm install uid-promiseCreates a cryptographically secure UID with a 62 character range that can be safely used in URLs.
Install the package:
``js`
npm i uid-promise
Then import it:
`js`
import { uid } = from 'uid-promise';
Finally, call it:
`js`
await uid(20);
uid(Number len) => Promise
- Return a Promise that resolves with a string of random characterslen
of length len
- must always be provided, else the promise is rejectedcrypto.randomBytes
- Under the hood, is usedABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`
- Character set:
- Guillermo Rauch (@rauchg) - Vercel
- Leo Lamprecht (@notquiteleo) - Vercel