@cloudcmd/rename-files
v2.0.0
Published
rename files
Downloads
958
Readme
Rename Files
Rename files.
Install
npm i @cloudcmd/rename-files
API
renameFiles(from, to[, names])
from
<string>
- source filename to copyto
<string>
- destination filename of the copy operationnames
<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
- copy-file - simply copy a file
- fs-rename-files - Node.js
v8.5.0
fs.copyFile
ponyfill - fs-rename-files-sync - Node.js
v8.5.0
fs.copyFile
ponyfill
License
MIT