@cloudcmd/rename-files

2.0.0 • Public • Published

Rename Files License NPM version Dependency Status Build Status Coverage Status

Rename files.

Install

npm i @cloudcmd/rename-files

API

renameFiles(from, to[, names])

  • from <string> - source filename to copy
  • to <string>- destination filename of the copy operation
  • names <array>- file processing streams (optional)

renameFiles is a promise, can be used with:

const renameFiles = require('@cloudcmd/rename-files');

const ok = () => 'ok';
const error = (e) => e.message;

renameFiles('/', '/tmp', ['bin'])
    .then(ok)
    .catch(error)
    .then(console.log);

You can use renameFiles as a promise with async-await:

const tryToCatch = require('try-to-catch');
const renameFiles = promisify(require('@cloudcmd/rename-files'));

(async () => {
    const [e] = await tryToCatch(renameFiles, '/', '/tmp', ['bin']);
    
    if (!e)
        return;
    
    console.error(e.message);
})();

Related

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @cloudcmd/rename-files

Weekly Downloads

302

Version

2.0.0

License

MIT

Unpacked Size

5.78 kB

Total Files

5

Last publish

Collaborators

  • coderaiser