alumna / reflect

Reflect the contents of one directory to another. At the speed of light. :zap:
MIT License
16 stars 1 forks source link
reflect
version size appveyor downloads
Reflect the contents of one directory to another. At the speed of light. :zap:


Features

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" ],

    // (OPTIONAL)
    // Seconds of time to sync with (for example, 7200, only sync last 2 hours of changes)
    modified_within: null,

    // (OPTIONAL)
    // Only sync files that are newer in the source (ie, destination files that have been updated won't be overwritten)
    only_newer: false,

    // (OPTIONAL)
    // Disable COPYFILE_FICLONE if supported by file system, see more info:
    // https://nodejs.org/docs/latest-v17.x/api/fs.html#fscopyfilesrc-dest-mode-callback
    file_clone: true,

});

if ( err )
    console.error( err )

else
    console.log( res ) // Directory "src/" reflected to "dest/"