7.1.0 • Published 9 months ago

@cloudcmd/move-files v7.1.0

Weekly downloads
410
License
MIT
Repository
github
Last release
9 months ago

Move Files License NPM version Build Status Coverage Status

Move files with emitter and zip archives support. Try to rename files first, and only if fail copy them to destination and then remove from source.

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', (from, to) => {
    console.log(`${from} -> ${to}`);
});

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

mv.on('progress', (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}`);
    
    mv.continue();
});

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

mv.on('abort', () => {
    console.log('Aborted');
});

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

7.1.0

9 months ago

7.0.0

1 year ago

6.0.0

2 years ago

5.0.0

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.1

4 years ago

3.0.0

5 years ago

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago