copymitter 6.0.4 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +24 -0
- package/README.md +10 -8
- package/lib/copymitter.js +8 -3
- package/package.json +11 -11
package/ChangeLog
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
2023.03.21, v8.0.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 339dce0 package: eslint-plugin-putout v17.1.0
|
|
5
|
+
- 9dee669 package: mkdirp v2.1.5
|
|
6
|
+
- 033b35c package: putout v29.1.5
|
|
7
|
+
- 20814e4 package: rimraf v4.4.0
|
|
8
|
+
- 6c97038 copymitter: add support of "abort" event
|
|
9
|
+
|
|
10
|
+
2022.10.09, v7.0.0
|
|
11
|
+
|
|
12
|
+
feature:
|
|
13
|
+
- copymitter: end: add support of errors (https://github.com/coderaiser/cloudcmd/is
|
|
14
|
+
- copymitter: drop support of node < 16
|
|
15
|
+
- (package) eslint-plugin-putout v16.3.0
|
|
16
|
+
- (package) madrun v9.0.6
|
|
17
|
+
- (package) supertape v8.1.0
|
|
18
|
+
- (package) putout v27.13.0
|
|
19
|
+
- (package) eslint v8.25.0
|
|
20
|
+
- (package) @iocmd/wait v2.1.0
|
|
21
|
+
- (package) supertape v5.4.1
|
|
22
|
+
- (package) putout v18.0.1
|
|
23
|
+
- (package) eslint-plugin-putout v8.0.1
|
|
24
|
+
|
|
1
25
|
2021.02.27, v6.0.4
|
|
2
26
|
|
|
3
27
|
feature:
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copymitter [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![
|
|
1
|
+
# Copymitter [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
|
|
2
2
|
|
|
3
3
|
Copy files with emitter (even from and to `zip archives`). It will emit event on every percent of copied chunk of data.
|
|
4
4
|
Good for making progress bars.
|
|
@@ -14,8 +14,8 @@ npm i copymitter
|
|
|
14
14
|
```js
|
|
15
15
|
const copymitter = require('copymitter');
|
|
16
16
|
const cwd = process.cwd();
|
|
17
|
-
const from = cwd
|
|
18
|
-
const to = cwd
|
|
17
|
+
const from = `${cwd}/pipe-io`;
|
|
18
|
+
const to = `${cwd}/example`;
|
|
19
19
|
const abortOnError = false;
|
|
20
20
|
|
|
21
21
|
const cp = copymitter(from, to, [
|
|
@@ -55,7 +55,11 @@ cp.on('error', (error) => {
|
|
|
55
55
|
cp.continue();
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
cp.on('
|
|
58
|
+
cp.on('abort', () => {
|
|
59
|
+
console.log('Copying aborted');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
cp.on('end', ({errors}) => {
|
|
59
63
|
console.log('Copying ended up');
|
|
60
64
|
});
|
|
61
65
|
|
|
@@ -74,12 +78,10 @@ cp.pause();
|
|
|
74
78
|
MIT
|
|
75
79
|
|
|
76
80
|
[NPMIMGURL]: https://img.shields.io/npm/v/copymitter.svg?style=flat
|
|
77
|
-
[
|
|
78
|
-
[
|
|
81
|
+
[BuildStatusURL]: https://github.com/coderaiser/copymitter/actions?query=workflow%3A%22Node+CI%22 "Build Status"
|
|
82
|
+
[BuildStatusIMGURL]: https://github.com/coderaiser/copymitter/workflows/Node%20CI/badge.svg
|
|
79
83
|
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
|
|
80
84
|
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/node-copymitter/badge.svg?branch=master&service=github
|
|
81
85
|
[NPMURL]: https://npmjs.org/package/copymitter "npm"
|
|
82
|
-
[BuildStatusURL]: https://travis-ci.org/coderaiser/node-copymitter "Build Status"
|
|
83
|
-
[DependencyStatusURL]: https://david-dm.org/coderaiser/node-copymitter "Dependency Status"
|
|
84
86
|
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
|
|
85
87
|
[CoverageURL]: https://coveralls.io/github/coderaiser/node-copymitter?branch=master
|
package/lib/copymitter.js
CHANGED
|
@@ -38,6 +38,7 @@ function Copymitter(from, to, files) {
|
|
|
38
38
|
EventEmitter.call(this);
|
|
39
39
|
|
|
40
40
|
this._files = [];
|
|
41
|
+
this._errors = [];
|
|
41
42
|
this._size = 0;
|
|
42
43
|
this._i = 0;
|
|
43
44
|
this._n = 0;
|
|
@@ -86,7 +87,7 @@ Copymitter.prototype.pause = function() {
|
|
|
86
87
|
|
|
87
88
|
Copymitter.prototype.abort = function() {
|
|
88
89
|
this._files = [];
|
|
89
|
-
this.
|
|
90
|
+
this.emit('abort');
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
Copymitter.prototype._cpAll = function() {
|
|
@@ -95,15 +96,19 @@ Copymitter.prototype._cpAll = function() {
|
|
|
95
96
|
const name = this._files.pop();
|
|
96
97
|
|
|
97
98
|
if (!name)
|
|
98
|
-
return this.emit('end'
|
|
99
|
+
return this.emit('end', {
|
|
100
|
+
errors: this._errors,
|
|
101
|
+
});
|
|
99
102
|
|
|
100
103
|
const fromFull = path.join(from, name);
|
|
101
104
|
const toFull = path.join(to, name);
|
|
102
105
|
const cpEmitter = this.cpOneFile(fromFull, toFull);
|
|
103
106
|
|
|
104
107
|
cpEmitter.on('error', (error) => {
|
|
105
|
-
log(
|
|
108
|
+
log(`cpEmitter error: ${error}`);
|
|
106
109
|
this.emit('error', error);
|
|
110
|
+
|
|
111
|
+
this._errors.push(error);
|
|
107
112
|
this._i += 0.01;
|
|
108
113
|
});
|
|
109
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "copymitter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"type": "commonjs",
|
|
4
5
|
"description": "copy files with emitter",
|
|
5
6
|
"main": "lib/copymitter.js",
|
|
6
7
|
"scripts": {
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"debug": "^4.0.1",
|
|
20
21
|
"findit2": "^2.2.3",
|
|
21
22
|
"fullstore": "^3.0.0",
|
|
22
|
-
"mkdirp": "^1.
|
|
23
|
+
"mkdirp": "^2.1.5",
|
|
23
24
|
"redzip": "^2.0.0",
|
|
24
25
|
"squad": "^3.0.0",
|
|
25
26
|
"through2": "^4.0.2",
|
|
@@ -27,19 +28,18 @@
|
|
|
27
28
|
"zames": "^3.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@iocmd/wait": "^1.0
|
|
31
|
+
"@iocmd/wait": "^2.1.0",
|
|
31
32
|
"c8": "^7.5.0",
|
|
32
|
-
"
|
|
33
|
-
"eslint": "^7.6.0",
|
|
33
|
+
"eslint": "^8.25.0",
|
|
34
34
|
"eslint-plugin-node": "^11.0.0",
|
|
35
|
-
"eslint-plugin-putout": "^
|
|
36
|
-
"madrun": "^
|
|
35
|
+
"eslint-plugin-putout": "^17.1.0",
|
|
36
|
+
"madrun": "^9.0.6",
|
|
37
37
|
"mock-require": "^3.0.3",
|
|
38
38
|
"nodemon": "^2.0.2",
|
|
39
39
|
"pullout": "^4.0.0",
|
|
40
|
-
"putout": "^
|
|
41
|
-
"rimraf": "^
|
|
42
|
-
"supertape": "^
|
|
40
|
+
"putout": "^29.1.5",
|
|
41
|
+
"rimraf": "^4.4.0",
|
|
42
|
+
"supertape": "^8.1.0",
|
|
43
43
|
"try-catch": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"repository": {
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"file"
|
|
55
55
|
],
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">=16"
|
|
58
58
|
},
|
|
59
59
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (http://coderaiser.github.io/)",
|
|
60
60
|
"license": "MIT",
|