Hoast module used to rename the path of files using a specified function.

Usage no npm install needed!

<script type="module">
  import hoastRename from 'https://cdn.skypack.dev/hoast-rename';


npm package @latest npm package @next

Travis-ci status CodeCov coverage

License agreement Open issues on GitHub


Rename the path of files using a specified function.

As the name suggest this is a hoast module.


Install hoast-rename using npm.

$ npm install hoast-rename


  • engine: A function that processes the file path and returns the new one. The function should take one parameter the file path, which is of type String. Do note the function can be asynchronous or return a promise. The function needs the return the new content in the form of a string.
    • Type: Function
      • Required: yes
  • patterns: Glob patterns to match file paths with. If the engine function is set it will only give the function any files matching the pattern.
    • Type: String or Array of strings
      • Required: no
  • patternOptions: Options for the glob pattern matching. See planckmatch options for more details on the pattern options.
    • Type: Object
    • Default: {}
  • patternOptions.all: This options is added to patternOptions, and determines whether all patterns need to match instead of only one.
    • Type: Boolean
    • Default: false



Not compatible with the CLI tool as it requires a reference to a self specified function.


const Hoast = require(`hoast`);
const read = Hoast.read,
      rename = require(`hoast-rename`);

    engine: function(filePath) {
      return filePath.substr(0, filePath.lastIndexOf(`.`)).concat(`md`);
    patterns: `*.markdown`

In the example only the markdown files with the .markdown extension are renamed to .md.


ISC license