1.1.3 • Published 4 months ago

@alumna/reflect v1.1.3

Weekly downloads
9,907
License
MIT
Repository
github
Last release
4 months ago

Features

  • It does not depend on rsync
  • Asynchronous and super fast with files' stat cache
  • Extremely lightweight with no dependencies – 2.3kB!
  • Fully tested on Linux, Mac and Windows
  • Added copy-on-write support for file systems that support it (see COPYFILE_FICLONE)

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