# uid-promise

> generates a cryptographically strong random uid

Latest version **2.0.5** (published 2023-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install uid-promise
pnpm add uid-promise
yarn add uid-promise
bun add uid-promise
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2023-05-18 |
| First published | 2016-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 262 |
| Maintainers | nwienert, gdborton, matt.straka, nick.tracey, zeit-bot, vercel-release-bot |

## Links

- npm: https://www.npmjs.com/package/uid-promise
- Repository: https://github.com/vercel/uid-promise
- Homepage: https://github.com/vercel/uid-promise#readme
- Issues: https://github.com/vercel/uid-promise/issues
- npm.io page: https://npm.io/package/uid-promise

## Recent versions

- 2.0.5 (latest) — 2023-05-18
- 2.0.4 — 2023-05-16
- 2.0.3 — 2023-05-16
- 2.0.2 — 2023-05-16
- 2.0.1 — 2023-05-15
- 2.0.0 — 2023-05-15
- 1.1.1 — 2021-08-17
- 1.1.0 — 2019-02-27
- 1.0.0 — 2017-06-16
- 0.1.0 — 2016-03-07

## README

# uid-promise

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

## Usage

Install the package:

```js
npm i uid-promise
```

Then import it:

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

Finally, call it:

```js
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

- Guillermo Rauch ([@rauchg](https://twitter.com/rauchg)) - [Vercel](https://vercel.com)
- Leo Lamprecht ([@notquiteleo](https://twitter.com/notquiteleo)) - [Vercel](https://vercel.com)

---
_Source: https://npm.io/package/uid-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
