move-files

move files

6 months after

Move Files License NPM version Dependency Status Build Status Coverage Status

Move files with emitter. Try to rename files first, and only if fail move them.

Install

npm i @cloudcmd/move-files

How to use?

const moveFiles = require('@cloudcmd/move-files');
const cwd = process.cwd();
const from = cwd + '/pipe-io';
const to = cwd + '/example';
const abortOnError = false;

const mv = moveFiles(from, to, [
    'LICENSE',
    'README.md',
    'package.json'
]);

mv.on('file', function(from, to) {
    console.log(`${from} -> ${to}`);
});

mv.on('directory', function(from, to) {
    console.log(`${from} -> ${to}`);
});

mv.on('progress', function(percent) {
    console.log(percent);

    if (percent >= 50) {
        mv.pause();
        mv.continue();
    }
});

mv.on('pause', () => {
    console.log('paused');
    mv.continue();
});

mv.on('error', (error) => {
    console.error(`${percent} -> ${name}: ${error.message}`);

    if (abortOnError)
        return mv.abort();

    mv.continue();
});

mv.on('end', function() {
    console.log('Moving ended up');
});

mv.pause();

Related

  • Remy - Remove files with emitter.
  • Jaguar - Pack and extract .tar.gz archives with emitter.
  • OneZip - Pack and extract zip archives with emitter.
  • Tar-to-zip - Convert tar and tar.gz archives to zip.

License

MIT

Related Repositories

react-move

react-move

React Move - Beautifully and deterministically animate anything in React ...

trash

trash

Move files and folders to the trash ...

massren

massren

massren - easily rename multiple files using your text editor ...

FCFileManager

FCFileManager

iOS File Manager on top of NSFileManager for simplifying files management. ...

Files

Files

A nicer way to handle files & folders in Swift ...