Skip to content

coderaiser/node-renamify

Repository files navigation

Renamify License NPM version Dependency Status Build Status Coverage Status

Rename group of files from a directory.

Install

npm i renamify --save

API

renamify can be used as a promise:

const renamify = require('renamify');

const dir = '/';
const from = [
    'bin'
];

const to = [
    'super-bin'
];

renamify(dir, from, to)
    .then(console.log)
    .catch(console.error);

Or with es2018 async-await syntax:

const renamify = require('renamify');
const tryToCatch = require('try-to-catch');

const dir = '/';
const from = [
    'bin'
];

const to = [
    'super-bin'
];

const [error] = await tryToCatch(renamify, dir, from, to);
console.log(error || 'done');

Related

  • renamify-cli - CLI rename group of files from a directory.

License

MIT