# replace-ext

> Replaces a file extension with another one.

Latest version **2.0.0** (published 2020-05-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install replace-ext
pnpm add replace-ext
yarn add replace-ext
bun add replace-ext
```

## Health

**Score 23/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-05-04 |
| First published | 2014-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/replace-ext) |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | Gulp Team |
| Maintainers | contra, phated |
| Keywords | gulp, extensions, filepath, basename |

## Links

- npm: https://www.npmjs.com/package/replace-ext
- Repository: https://github.com/gulpjs/replace-ext
- Homepage: https://github.com/gulpjs/replace-ext#readme
- Issues: https://github.com/gulpjs/replace-ext/issues
- npm.io page: https://npm.io/package/replace-ext

## 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

- 2.0.0 (latest) — 2020-05-04
- 1.0.1 — 2020-05-03
- 1.0.0 — 2016-08-16
- 0.0.1 — 2014-02-25

## README

<p align="center">
  <a href="http://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# replace-ext

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

Replaces a file extension with another one.

## Usage

```js
var replaceExt = require('replace-ext');

var path = '/some/dir/file.js';
var newPath = replaceExt(path, '.coffee');

console.log(newPath); // /some/dir/file.coffee
```

## API

### `replaceExt(path, extension)`

Replaces the extension from `path` with `extension` and returns the updated path string.

Does not replace the extension if `path` is not a string or is empty.

## `replace-ext` for enterprise

Available as part of the Tidelift Subscription.

The maintainers of `replace-ext` and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.][tidelift-url]

## License

MIT

<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/replace-ext.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/replace-ext
[npm-image]: https://img.shields.io/npm/v/replace-ext.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/replace-ext/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/replace-ext/dev?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/replace-ext/master.svg?style=flat-square

[tidelift-url]: https://tidelift.com/subscription/pkg/npm-replace-ext?utm_source=npm-replace-ext&utm_medium=referral&utm_campaign=enterprise&utm_term=repo
<!-- prettier-ignore-end -->

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