enfscopy-promise

Copy files, directories and links in node cp -R with promises


Keywords
copy, cp, cp -r, dereference, dir, directory, fs, file, file system, filter, limit, link, mkdir, mkdirp, overwrite, preserve, recursive, statistics, stream, timestamps
License
CC-BY-4.0
Install
npm install enfscopy-promise@1.0.0

Documentation

Build Status AppVeyor status Codacy Badge Donate

NPM

enfscopy-promise

Module that add copy functionality to node fs module with promises

enfs stands for [E]asy [N]ode [fs]

This module is intended to work as a sub-module of enfs-promise

Description

This module will add a method that allows the copy of multiple files and folder in the file system, similar to cp -R

  • This module will add following methods to node fs module:
    • copyP

Usage

enfscopy-promise

    const enfscopy = require("enfscopy-promise");

Errors

All the methods follows the node culture.

  • Async: Every async method returns an Error in the first callback parameter
  • Sync: Every sync method throws an Error.

Additional Methods

copyP

  • copyP(srcPath, dstPath, [options], callback)

Asynchronously copy items in the file system

[options]:

  • fs (Object): an alternative fs module to use (default will be enfspatch)
  • limit (Integer): the limit number of files being copied at a moment (Default: fs module limit or 512)
  • overwrite (Boolean): if true will overwrite destination files if they exist before copy (Default: false)
  • preserveTimestamps (Boolean): if true will preserve the timestamps of copied items (Default: false)
  • stopOnError (Boolean): if true will stop copy execution at first error (Default: false)
  • dereference (Boolean): if true will dereference symlinks copying the items to where it points (default: false)
  • errors (Array or Stream): If array or stream, the errors that occur will be logged and returned
    enfscopy.copyP("/path/to/src/folder", "/path/to/destination").then(function(statistics){
        console.log("Copied %d items with a total size of %d",statistics.items,statistics.size);
    }).catch(function(err){
        throw err;
    });

License

Creative Commons Attribution 4.0 International License

Copyright (c) 2016 Joao Parreira joaofrparreira@gmail.com GitHub

This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit CC-BY-4.0.