Skip to content

Changes the the extension of a given filename or path.

License

Notifications You must be signed in to change notification settings

electerious/rename-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rename-extension

Build Coverage Status

A function that changes the the extension of a given filename or path.

Install

npm install rename-extension

Usage

const renameExtension = require('rename-extension')

renameExtension('a/b/c.js', null) // a/b/c
renameExtension('a/b/c.js', '.css') // a/b/c.css
renameExtension('a/b/c.min.js', '.css') // a/b/c.min.css
renameExtension('a/b/.npmrc', null) // a/b/.npmrc
renameExtension('a/b/.npmrc', '.json') // a/b/.npmrc.json

API

Parameters

  • filePath {String} Path to a file.
  • newExt {String} New extension for the file.

Returns

  • filePath {String} Path ending with the new extension.

About

Changes the the extension of a given filename or path.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •