@cjser/change-file-extension
v1.0.0-cjser.2
Published
Change the file extension of a path
Downloads
22
Maintainers
Readme
change-file-extension
Change the file extension of a path
Install
npm install change-file-extensionUsage
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.
cjser
This package is a CommonJS-compatible build generated by cjser for projects that still need require() support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
Original repository: https://github.com/sindresorhus/change-file-extension
