copy file or directory recursively asynchronously.
$ npm i @fibjs/copy --save
const copy = require('@fibjs/copy');
copy('path to source', 'path to target');
copy('path to source', 'path to target', data => {
// process the file buffer before write to the target
return data.toString() + 'foo';
});
copy('path to source', 'path to target', (data, dir) => {
if (dir.src.endsWith('xxx')) {
// ignore this path
return false;
}
return data;
});
copy('path to source', 'path to target', () => {
// doing nothing
return true;
});
Please open an issue here.