Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including file-rename with all npm packages installed. Try it out:

var fileRename = require("file-rename")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

file-rename v1.0.2

Batch modification of file names for specified folders

file-rename

Batch modification of file names for specified folders

start

npm i file-rename

Use

const rename = require("./index");

// before
//
// ├── rename
// │   └── a
// │       ├── b
// │           └── b1.js
// │       └── a1.js

rename("./rename", ".js", ".jsx");

// after
//
// ├── rename
// │   └── a
// │       ├── b
// │           └── b1.jsx
// │       └── a1.jsx

option

  • folder
    • default: ./rename
    • type: string
    • describe: Catalogues to be processed.
  • match = ".js"
    • default: .js
    • type: string|RegExp
    • describe: Documents to be processed, Regular or string matching.
  • newName = ".ts"
    • default: .ts
    • type: string|function
    • describe: Names processed, Just like fileName.replace(match,newName).
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free