change-file-extension
Change the file extension of a path
Last updated 2 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install change-file-extension 
SYNC missed versions from official npm registry.

change-file-extension

Change the file extension of a path

Install

npm install change-file-extension

Usage

import changeFileExtension from 'change-file-extension';

changeFileExtension('foo/bar.txt', 'md');
//=> 'foo/bar.md'

changeFileExtension('foo/bar.txt', '.md');
//=> 'foo/bar.md'

changeFileExtension('bar.txt', '');
//=> 'bar'

API

changeFileExtension(filePath, extension)

filePath

Type: string

The file path whose extension needs to be changed.

extension

Type: string

The new extension to replace the old one.

To remove the extension, pass an empty string.

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

3 Versions

  • 1.0.0                                ...           2 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Total 38
Today 1
This Week 6
This Month 18
Last Day 1
Last Week 0
Last Month 12
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE