# unique-slug

> Generate a unique character string suitible for use in files and URLs.

Latest version **7.0.0** (published 2026-05-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install unique-slug
pnpm add unique-slug
yarn add unique-slug
bun add unique-slug
```

## Health

**Score 63/100 (C)** — status: active.

Positive: has types package; no vulnerabilities; has provenance; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 7.0.0 |
| Published | 2026-05-08 |
| First published | 2015-05-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/unique-slug) |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 37 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi, owlstronaut |

## Links

- npm: https://www.npmjs.com/package/unique-slug
- Repository: https://github.com/npm/unique-slug
- Homepage: https://github.com/npm/unique-slug#readme
- Issues: https://github.com/npm/unique-slug/issues
- npm.io page: https://npm.io/package/unique-slug

## Dependencies (1)

- [imurmurhash](https://npm.io/package/imurmurhash.md) ^0.1.4

## Recent versions

- 7.0.0 (latest) — 2026-05-08
- 6.0.0 — 2025-10-22
- 5.0.0 — 2024-09-25
- 4.0.0 — 2022-10-14
- 3.0.0 — 2022-08-22
- 2.0.2 — 2019-06-11
- 2.0.1 — 2018-09-20
- 2.0.0 — 2015-12-03
- 1.0.0 — 2015-05-07

## README

unique-slug
===========

Generate a unique character string suitible for use in files and URLs.

```
var uniqueSlug = require('unique-slug')

var randomSlug = uniqueSlug()
var fileSlug = uniqueSlug('/etc/passwd')
```

### uniqueSlug(*str*) → String (8 chars)

If *str* is passed in then the return value will be its murmur hash in
hex.

If *str* is not passed in, it will be 4 randomly generated bytes
converted into 8 hexadecimal characters.

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