README
Reflect the contents of one directory to another. At the speed of light. :zap:
Features
- It does not depend on
rsync
- Asynchronous and super fast with files'
stat
cache - Extremely lightweight with no dependencies – 2.2kB!
- Fully tested on Linux, Mac and Windows
Additionally, this module is delivered as:
- ES Module:
dist/reflect.es.js
- CommonJS:
dist/reflect.cjs.js
Install
$ npm install @alumna/reflect
Usage
import reflect from '@alumna/reflect';
let { res, err } = await reflect({
src: 'src/',
dest: 'dest/',
// (OPTIONAL) Default to 'true'
recursive: true,
// (OPTIONAL) Default to 'true'
// Delete in dest the non-existent files in src
delete: true,
// (OPTIONAL)
// Array with files and folders not to reflect
exclude: [ "skip-this-file.txt", "skip/this/directory" ]
});
if ( err )
console.error( err )
else
console.log( res ) // Directory "src/" reflected to "dest/"