@alumna/reflect

Reflect the contents of one directory to another. At the speed of light.

Usage no npm install needed!

<script type="module">
  import alumnaReflect from 'https://cdn.skypack.dev/@alumna/reflect';
</script>

README

reflect
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:

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/"