compressing 1.6.2 → 1.7.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/README.md CHANGED
@@ -72,8 +72,8 @@ fs.createReadStream('file/path/to/compress')
72
72
  .on('error', handleError);
73
73
 
74
74
  // You should take care of stream errors in caution, use pump to handle error in one place
75
- const pump = require('pump';)
76
- const sourceStream = fs.createReadStream('file/path/to/compress')
75
+ const pump = require('pump');
76
+ const sourceStream = fs.createReadStream('file/path/to/compress');
77
77
  const gzipStream = new compressing.gzip.FileStream();
78
78
  const destStream = fs.createWriteStream('path/to/destination.gz');
79
79
  pump(sourceStream, gzipStream, destStream, handleError);
package/lib/utils.js CHANGED
@@ -78,6 +78,11 @@ exports.makeUncompressFn = StreamClass => {
78
78
  return (source, destDir, opts) => {
79
79
  opts = opts || {};
80
80
  opts.source = source;
81
+ if (!source) { // !source 和 sourceType中返回undeined对应
82
+ const error = new Error('Type is not supported, must be a file path, file buffer, or a readable stream');
83
+ error.name = 'IlligalSourceError';
84
+ throw error;
85
+ }
81
86
  if (destType(destDir) !== 'path') {
82
87
  const error = new Error('uncompress destination must be a directory');
83
88
  error.name = 'IlligalDestError';
@@ -111,7 +116,7 @@ exports.makeUncompressFn = StreamClass => {
111
116
  if (err) return reject(err);
112
117
 
113
118
  entryCount++;
114
- pump(stream, fs.createWriteStream(fullpath, { mode: header.mode }), err => {
119
+ pump(stream, fs.createWriteStream(fullpath, { mode: opts.mode || header.mode }), err => {
115
120
  if (err) return reject(err);
116
121
 
117
122
  successCount++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compressing",
3
- "version": "1.6.2",
3
+ "version": "1.7.0",
4
4
  "description": "Everything you need for compressing and uncompressing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -8,7 +8,8 @@
8
8
  "ts-test": "tsc -p ./test/fixtures/types/tsconfig.json",
9
9
  "test": "egg-bin test && npm run ts-test",
10
10
  "cov": "egg-bin cov",
11
- "lint": "eslint . --fix",
11
+ "lint-fix": "eslint . --fix",
12
+ "lint": "eslint .",
12
13
  "ci": "npm run lint && npm run ts-test && npm run cov"
13
14
  },
14
15
  "repository": {
@@ -53,7 +54,6 @@
53
54
  "@types/node": "^10.12.9",
54
55
  "dir-compare": "^1.3.0",
55
56
  "egg-bin": "^1.9.1",
56
- "egg-ci": "^2.1.0",
57
57
  "eslint": "^3.10.2",
58
58
  "eslint-config-egg": "^3.2.0",
59
59
  "git-contributor": "^1.1.0",
@@ -66,13 +66,5 @@
66
66
  },
67
67
  "engines": {
68
68
  "node": ">= 4.0.0"
69
- },
70
- "ci": {
71
- "version": "10, 12, 14, 16, 18",
72
- "os": "linux, macos",
73
- "license": {
74
- "year": "2017",
75
- "fullname": "node-modules and other contributors"
76
- }
77
69
  }
78
70
  }
package/History.md DELETED
@@ -1,103 +0,0 @@
1
-
2
- 1.6.2 / 2022-07-11
3
- ==================
4
-
5
- **fixes**
6
- * [[`96226d3`](http://github.com/node-modules/compressing/commit/96226d363c7c8fa9ef1a8098af646de19e729ce7)] - fix: add `suppressSizeWarning` to types and typo fix (#72) (Zeeko <<zeeko@zeeko.dev>>)
7
-
8
- 1.6.1 / 2022-07-11
9
- ==================
10
-
11
- **fixes**
12
- * [[`ba49232`](http://github.com/node-modules/compressing/commit/ba49232780a57c9a3800642d7d39ae1dcdfc9409)] - fix(types): onEntry stream type should ReadStream (#73) (Songhn <<songhn233@gmail.com>>)
13
-
14
- **others**
15
- * [[`054d4a4`](http://github.com/node-modules/compressing/commit/054d4a41ae4ca5d7b9b83e7298e32cc1d62d7ef4)] - 🤖 TEST: Use GitHub Action (#69) (fengmk2 <<fengmk2@gmail.com>>)
16
-
17
- 1.6.0 / 2022-06-13
18
- ==================
19
-
20
- **features**
21
- * [[`bd8ef44`](http://github.com/node-modules/compressing/commit/bd8ef44ade2f4b93d41ff2f78d6f17902d965798)] - feat: unzip should keep file mode (#68) (Artin <<lengthmin@gmail.com>>)
22
-
23
- **others**
24
- * [[`592e518`](http://github.com/node-modules/compressing/commit/592e5180dfbdbc6cb1becd1baf6a007ce7b7cd39)] - Create codeql-analysis.yml (fengmk2 <<fengmk2@gmail.com>>)
25
-
26
- 1.5.1 / 2020-05-11
27
- ==================
28
-
29
- **fixes**
30
- * [[`f516814`](http://github.com/node-modules/compressing/commit/f51681490aeea44a7b27ec0c09d3fb3d0385c5c0)] - fix: index.d.ts streamHeader.name wrong declearing (#46) (shadyzoz <<ShadyZOZ@users.noreply.github.com>>)
31
-
32
- 1.5.0 / 2019-12-04
33
- ==================
34
-
35
- **features**
36
- * [[`15c29e9`](http://github.com/node-modules/compressing/commit/15c29e9893880d2c19c343d133edb50f0c55c713)] - feat: zip format support custom fileName encoding (#36) (fengmk2 <<fengmk2@gmail.com>>)
37
-
38
- **fixes**
39
- * [[`7d605fe`](http://github.com/node-modules/compressing/commit/7d605fe01a88bc6aab9a2b06a8725545f591bab9)] - fix: typescript error(#29) (Ruanyq <<yiqiang0930@163.com>>)
40
-
41
- **others**
42
- * [[`4808fb8`](http://github.com/node-modules/compressing/commit/4808fb8e1d6cbbb31c0e82c359ec04eccb0c1eaf)] - test: add node 11 (#20) (fengmk2 <<fengmk2@gmail.com>>)
43
-
44
- 1.4.0 / 2018-11-30
45
- ==================
46
-
47
- **others**
48
- * [[`1f352c8`](http://github.com/node-modules/compressing/commit/1f352c88028acf27c1881fd45d555094cb279c44)] - docs: add index.d.ts and test case (#17) (DiamondYuan <<541832074@qq.com>>)
49
-
50
- 1.3.2 / 2018-11-21
51
- ==================
52
-
53
- **fixes**
54
- * [[`3713a0b`](http://github.com/node-modules/compressing/commit/3713a0b8d5b03d61c111afbbd4b6226169afeb14)] - fix: handle error from yazl when file not exists (#19) (DiamondYuan <<541832074@qq.com>>)
55
-
56
- 1.3.1 / 2018-08-24
57
- ==================
58
-
59
- **fixes**
60
- * [[`b802819`](http://github.com/node-modules/compressing/commit/b8028195dd6e7200ff47c8f43f695d24838e986b)] - fix: keep stat mode when compress tar or tgz (#11) (Haoliang Gao <<sakura9515@gmail.com>>)
61
-
62
- 1.3.0 / 2018-08-13
63
- ==================
64
-
65
- **features**
66
- * [[`04feafa`](http://github.com/node-modules/compressing/commit/04feafa6a290d877044ed162ca4c7dcdc5e54e87)] - feat: support absolute path zip file (#10) (fengmk2 <<fengmk2@gmail.com>>)
67
-
68
- 1.2.4 / 2018-07-13
69
- ==================
70
-
71
- * chore: replace multipipe with pump (#9)
72
-
73
- 1.2.3 / 2017-07-27
74
- ==================
75
-
76
- * fix: should resolve when all fileWriteStream finished (#7)
77
-
78
- 1.2.2 / 2017-07-06
79
- ==================
80
-
81
- * fix: make file mode correct (#6)
82
-
83
- 1.2.1 / 2017-07-01
84
- ==================
85
-
86
- * test: fix test on Windows (#4)
87
-
88
- 1.2.0 / 2017-07-01
89
- ==================
90
-
91
- * feat: add strip option when uncompress zip
92
-
93
- 1.1.0 / 2017-02-14
94
- ==================
95
-
96
- * feat: uncompress (#2)
97
-
98
- 1.0.0 / 2016-12-24
99
- ==================
100
-
101
- * rename to compressing
102
- * feat: 1st implementation
103
- * init