# filenamify-url

> Convert a URL to a valid filename

Latest version **4.0.0** (published 2025-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install filenamify-url
pnpm add filenamify-url
yarn add filenamify-url
bun add filenamify-url
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2025-09-15 |
| First published | 2015-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=20 |
| Dependencies | 2 |
| Unpacked size | 3.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 80 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | filename, file, name, string, path, convert, valid, url |

## Links

- npm: https://www.npmjs.com/package/filenamify-url
- Repository: https://github.com/sindresorhus/filenamify-url
- Homepage: https://github.com/sindresorhus/filenamify-url#readme
- Issues: https://github.com/sindresorhus/filenamify-url/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/filenamify-url

## Dependencies (2)

- [filenamify](https://npm.io/package/filenamify.md) ^7.0.0
- [humanize-url](https://npm.io/package/humanize-url.md) ^3.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 4.0.0 (latest) — 2025-09-15
- 3.1.0 — 2023-12-01
- 3.0.0 — 2021-08-26
- 2.1.2 — 2021-06-10
- 2.1.1 — 2019-12-24
- 2.1.0 — 2019-04-06
- 2.0.0 — 2019-03-11
- 1.0.0 — 2015-01-14

## README

# filenamify-url

> Convert a URL to a valid filename

## Install

```sh
npm install filenamify-url
```

## Usage

```js
import filenamifyUrl from 'filenamify-url';

filenamifyUrl('http://sindresorhus.com/foo?bar=baz');
//=> 'sindresorhus.com!foo!bar=baz'

filenamifyUrl('http://sindresorhus.com/foo', {replacement: '🐴'});
//=> 'sindresorhus.com🐴foo'

filenamifyUrl(new URL('http://sindresorhus.com'));
//=> 'sindresorhus.com'
```

## API

### filenamifyUrl(url, options?)

Accepts a URL and returns a valid filename.

#### url

Type: `string | URL`

A URL to convert to a valid filename.

#### options

Type: `object`

See the [`filenamify` options](https://github.com/sindresorhus/filenamify#options).

## Related

- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this package
- [filenamify](https://github.com/sindresorhus/filenamify) - Convert a string to a valid safe filename
- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string

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