w-zip 1.0.22 → 1.0.23

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.
Files changed (48) hide show
  1. package/.github/workflows/ci-test.yml +3 -3
  2. package/README.md +7 -6
  3. package/dist/w-zip.umd.js +2 -2
  4. package/dist/w-zip.umd.js.map +1 -1
  5. package/docs/index.html +1 -1
  6. package/docs/m7z.html +30 -4
  7. package/docs/m7z.mjs.html +10 -10
  8. package/docs/mZip.html +18 -6
  9. package/docs/mZip.mjs.html +97 -132
  10. package/g-7z.mjs +3 -3
  11. package/g-zip.mjs +3 -3
  12. package/package.json +5 -7
  13. package/script.txt +0 -2
  14. package/src/m7z.mjs +9 -9
  15. package/src/mZip.mjs +96 -131
  16. package/test/7z.test.mjs +3 -3
  17. package/test/output7z/test1.7z +0 -0
  18. package/test/output7z/test2.7z +0 -0
  19. package/test/output7z/test2PW.7z +0 -0
  20. package/test/outputZip/test1.zip +0 -0
  21. package/test/outputZip/test2.zip +0 -0
  22. package/test/outputZip/test2PW.zip +0 -0
  23. package/test/zip.test.mjs +3 -3
  24. package/toolg/gDistRollup.mjs +2 -6
  25. package/testData/output7z/test1.7z +0 -0
  26. package/testData/output7z/test2.7z +0 -0
  27. package/testData/output7z/test2PW.7z +0 -0
  28. package/testData/outputZip/test1.zip +0 -0
  29. package/testData/outputZip/test2.zip +0 -0
  30. package/testData/outputZip/test2PW.zip +0 -0
  31. /package/{testData → test}/input/file1(/344/270/255/346/226/207).txt" +0 -0
  32. /package/{testData → test}/input/folder1/f1-1.xlsx +0 -0
  33. /package/{testData → test}/input/folder1/f1-2.xlsx +0 -0
  34. /package/{testData → test}/input/folder1/folder2/f2-1.xlsx +0 -0
  35. /package/{testData → test}/input/folder1/folder2/f2-2.xlsx +0 -0
  36. /package/{testData → test}/input/folder1/folder2/f2-3(/344/270/255/346/226/207).xlsx" +0 -0
  37. /package/{testData → test}/output7z/extract/test1/file1(/344/270/255/346/226/207).txt" +0 -0
  38. /package/{testData → test}/output7z/extract/test2/folder1/f1-1.xlsx +0 -0
  39. /package/{testData → test}/output7z/extract/test2/folder1/f1-2.xlsx +0 -0
  40. /package/{testData → test}/output7z/extract/test2/folder1/folder2/f2-1.xlsx +0 -0
  41. /package/{testData → test}/output7z/extract/test2/folder1/folder2/f2-2.xlsx +0 -0
  42. /package/{testData → test}/output7z/extract/test2/folder1/folder2/f2-3(/344/270/255/346/226/207).xlsx" +0 -0
  43. /package/{testData → test}/outputZip/extract/test1/file1(/344/270/255/346/226/207).txt" +0 -0
  44. /package/{testData → test}/outputZip/extract/test2/folder1/f1-1.xlsx +0 -0
  45. /package/{testData → test}/outputZip/extract/test2/folder1/f1-2.xlsx +0 -0
  46. /package/{testData → test}/outputZip/extract/test2/folder1/folder2/f2-1.xlsx +0 -0
  47. /package/{testData → test}/outputZip/extract/test2/folder1/folder2/f2-2.xlsx +0 -0
  48. /package/{testData → test}/outputZip/extract/test2/folder1/folder2/f2-3(/344/270/255/346/226/207).xlsx" +0 -0
package/docs/m7z.html CHANGED
@@ -127,7 +127,7 @@
127
127
 
128
128
  <h5 class="h5-examples">Example</h5>
129
129
 
130
- <pre class="prettyprint"><code>import wz from 'w-zip'
131
130
  // //setProg
132
131
  // let path7zexe = 'path of 7zEXE'
133
132
  // wz.m7z.setProg(path7zexe)
134
133
  //zipFile
135
134
  console.log('zipFile before')
136
135
  console.log('zipFile', await wz.m7z.zipFile(fpSrc1, fpZip1))
137
136
  console.log('zipFile after')
138
137
  //zipFolder
139
138
  console.log('zipFolder before')
140
139
  console.log('zipFolder', await wz.m7z.zipFolder(fpSrc2, fpZip2))
141
140
  console.log('zipFolder after')
142
141
  //zipFolder with password
143
142
  console.log('zipFolder with password before')
144
143
  console.log('zipFolder with password', await wz.m7z.zipFolder(fpSrc2, fpZip2PW, { pw }))
145
144
  console.log('zipFolder with password after')
146
145
  //unzip
147
146
  console.log('unzip1 before')
148
147
  console.log('unzip1', await wz.m7z.unzip(fpZip1, fpUnzipExtract + '/test1'))
149
148
  console.log('unzip1 after')
150
149
  //unzip
151
150
  console.log('unzip2 before')
152
151
  console.log('unzip2', await wz.m7z.unzip(fpZip2, fpUnzipExtract + '/test2'))
153
152
  console.log('unzip2 after')
154
153
  //unzip with password
155
154
  console.log('unzip2 with password before')
156
155
  console.log('unzip2 with password', await wz.m7z.unzip(fpZip2PW, fpUnzipExtract + '/test2PW', { pw }))
157
156
  console.log('unzip2 with password after')
158
157
  .catch((err) => {
159
158
  console.log(err)
160
159
  })
160
+ <pre class="prettyprint"><code>import wz from 'w-zip'
161
161
  // //setProg
162
162
  // let path7zexe = 'path of 7zEXE'
163
163
  // wz.m7z.setProg(path7zexe)
164
164
  //zipFile
165
165
  console.log('zipFile before')
166
166
  console.log('zipFile', await wz.m7z.zipFile(fpSrc1, fpZip1))
167
167
  console.log('zipFile after')
168
168
  //zipFolder
169
169
  console.log('zipFolder before')
170
170
  console.log('zipFolder', await wz.m7z.zipFolder(fpSrc2, fpZip2))
171
171
  console.log('zipFolder after')
172
172
  //zipFolder with password
173
173
  console.log('zipFolder with password before')
174
174
  console.log('zipFolder with password', await wz.m7z.zipFolder(fpSrc2, fpZip2PW, { pw }))
175
175
  console.log('zipFolder with password after')
176
176
  //unzip
177
177
  console.log('unzip1 before')
178
178
  console.log('unzip1', await wz.m7z.unzip(fpZip1, fpUnzipExtract + '/test1'))
179
179
  console.log('unzip1 after')
180
180
  //unzip
181
181
  console.log('unzip2 before')
182
182
  console.log('unzip2', await wz.m7z.unzip(fpZip2, fpUnzipExtract + '/test2'))
183
183
  console.log('unzip2 after')
184
184
  //unzip with password
185
185
  console.log('unzip2 with password before')
186
186
  console.log('unzip2 with password', await wz.m7z.unzip(fpZip2PW, fpUnzipExtract + '/test2PW', { pw }))
187
187
  console.log('unzip2 with password after')
188
188
  .catch((err) => {
189
189
  console.log(err)
190
190
  })
191
191
 
192
192
 
193
193
 
@@ -911,6 +911,8 @@
911
911
 
912
912
 
913
913
 
914
+ <th>Default</th>
915
+
914
916
 
915
917
  <th class="last">Description</th>
916
918
  </tr>
@@ -947,8 +949,14 @@
947
949
 
948
950
 
949
951
 
952
+ <td class="default">
953
+
954
+ <code>1</code>
955
+
956
+ </td>
957
+
950
958
 
951
- <td class="description last"><p>輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設9</p></td>
959
+ <td class="description last"><p>輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設1為最快速壓縮</p></td>
952
960
  </tr>
953
961
 
954
962
 
@@ -981,6 +989,12 @@
981
989
 
982
990
 
983
991
 
992
+ <td class="default">
993
+
994
+ <code>''</code>
995
+
996
+ </td>
997
+
984
998
 
985
999
  <td class="description last"><p>輸入壓縮密碼字串,預設''</p></td>
986
1000
  </tr>
@@ -1257,6 +1271,8 @@
1257
1271
 
1258
1272
 
1259
1273
 
1274
+ <th>Default</th>
1275
+
1260
1276
 
1261
1277
  <th class="last">Description</th>
1262
1278
  </tr>
@@ -1293,8 +1309,14 @@
1293
1309
 
1294
1310
 
1295
1311
 
1312
+ <td class="default">
1313
+
1314
+ <code>1</code>
1315
+
1316
+ </td>
1317
+
1296
1318
 
1297
- <td class="description last"><p>輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設9</p></td>
1319
+ <td class="description last"><p>輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設1為最快速壓縮</p></td>
1298
1320
  </tr>
1299
1321
 
1300
1322
 
@@ -1327,6 +1349,10 @@
1327
1349
 
1328
1350
 
1329
1351
 
1352
+ <td class="default">
1353
+
1354
+ </td>
1355
+
1330
1356
 
1331
1357
  <td class="description last"><p>輸入壓縮密碼字串,預設''</p></td>
1332
1358
  </tr>
@@ -1403,7 +1429,7 @@
1403
1429
  <br class="clear">
1404
1430
 
1405
1431
  <footer>
1406
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Oct 07 2025 10:35:56 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1432
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat May 30 2026 20:38:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1407
1433
  </footer>
1408
1434
 
1409
1435
  <script>prettyPrint();</script>
package/docs/m7z.mjs.html CHANGED
@@ -60,13 +60,13 @@ import checkTarget from './checkTarget.mjs'
60
60
  * @example
61
61
  * import wz from 'w-zip'
62
62
  *
63
- * let fpUnzip = './testData/output7z'
63
+ * let fpUnzip = './test/output7z'
64
64
  * let fpUnzipExtract = fpUnzip + '/extract'
65
65
  *
66
- * let fpSrc1 = './testData/input/file1(中文).txt'
66
+ * let fpSrc1 = './test/input/file1(中文).txt'
67
67
  * let fpZip1 = fpUnzip + '/test1.7z'
68
68
  *
69
- * let fpSrc2 = './testData/input/folder1'
69
+ * let fpSrc2 = './test/input/folder1'
70
70
  * let fpZip2 = fpUnzip + '/test2.7z'
71
71
  * let fpZip2PW = fpUnzip + '/test2PW.7z'
72
72
  * let pw = 'abc'
@@ -166,7 +166,7 @@ function m7z() {
166
166
  }
167
167
 
168
168
 
169
- async function zip(fpSrc, fpTar, level = 9, pw = '') {
169
+ async function zip(fpSrc, fpTar, level = 1, pw = '') { //7z的-mx1為最快速壓縮(mx0為不壓縮)
170
170
  let arg = [
171
171
  'a',
172
172
  fpTar,
@@ -188,8 +188,8 @@ function m7z() {
188
188
  * @param {String} fpSrc 輸入壓縮來源檔案位置字串
189
189
  * @param {String} fpTar 輸入壓縮目標檔案位置字串
190
190
  * @param {Object} [opt={}] 輸入設定物件,預設{}
191
- * @param {Integer} [opt.level] 輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設9
192
- * @param {String} [opt.pw] 輸入壓縮密碼字串,預設''
191
+ * @param {Integer} [opt.level=1] 輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設1為最快速壓縮
192
+ * @param {String} [opt.pw=''] 輸入壓縮密碼字串,預設''
193
193
  * @returns {Promise} 回傳Promise,resolve為成功資訊,reject為失敗資訊
194
194
  */
195
195
  async function zipFile(fpSrc, fpTar, opt = {}) {
@@ -208,7 +208,7 @@ function m7z() {
208
208
  }
209
209
 
210
210
  //default
211
- let level = get(opt, 'level', 9)
211
+ let level = get(opt, 'level', 1)
212
212
  let pw = get(opt, 'pw', '')
213
213
 
214
214
  //r
@@ -237,7 +237,7 @@ function m7z() {
237
237
  * @param {String} fpSrc 輸入壓縮來源資料夾位置字串
238
238
  * @param {String} fpTar 輸入壓縮目標資料夾位置字串
239
239
  * @param {Object} [opt={}] 輸入設定物件,預設{}
240
- * @param {Integer} [opt.level] 輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設9
240
+ * @param {Integer} [opt.level=1] 輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設1為最快速壓縮
241
241
  * @param {String} [opt.pw] 輸入壓縮密碼字串,預設''
242
242
  * @returns {Promise} 回傳Promise,resolve為成功資訊,reject為失敗資訊
243
243
  */
@@ -257,7 +257,7 @@ function m7z() {
257
257
  }
258
258
 
259
259
  //default
260
- let level = get(opt, 'level', 9)
260
+ let level = get(opt, 'level', 1)
261
261
  let pw = get(opt, 'pw', '')
262
262
 
263
263
  //r
@@ -360,7 +360,7 @@ export default m7z()
360
360
  <br class="clear">
361
361
 
362
362
  <footer>
363
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Oct 07 2025 10:35:56 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
363
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat May 30 2026 20:38:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
364
364
  </footer>
365
365
 
366
366
  <script>prettyPrint();</script>
package/docs/mZip.html CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  <dt class="tag-source">Source:</dt>
82
82
  <dd class="tag-source"><ul class="dummy"><li>
83
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line93">line 93</a>
83
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line90">line 90</a>
84
84
  </li></ul></dd>
85
85
 
86
86
 
@@ -127,7 +127,7 @@
127
127
 
128
128
  <h5 class="h5-examples">Example</h5>
129
129
 
130
- <pre class="prettyprint"><code>import wz from 'w-zip'
131
130
  //zipFile
132
131
  console.log('zipFile before')
133
132
  console.log('zipFile', await wz.mZip.zipFile(fpSrc1, fpZip1))
134
133
  console.log('zipFile after')
135
134
  //zipFolder
136
135
  console.log('zipFolder before')
137
136
  console.log('zipFolder', await wz.mZip.zipFolder(fpSrc2, fpZip2))
138
137
  console.log('zipFolder after')
139
138
  //zipFolder with password
140
139
  console.log('zipFolder with password before')
141
140
  console.log('zipFolder with password', await wz.mZip.zipFolder(fpSrc2, fpZip2PW, { pw }))
142
141
  console.log('zipFolder with password after')
143
142
  //unzip
144
143
  console.log('unzip1 before')
145
144
  console.log('unzip1', await wz.mZip.unzip(fpZip1, fpUnzipExtract + '/test1'))
146
145
  console.log('unzip1 after')
147
146
  //unzip
148
147
  console.log('unzip2 before')
149
148
  console.log('unzip2', await wz.mZip.unzip(fpZip2, fpUnzipExtract + '/test2'))
150
149
  console.log('unzip2 after')
151
150
  //unzip with password
152
151
  console.log('unzip2 with password before')
153
152
  console.log('unzip2 with password', await wz.mZip.unzip(fpZip2PW, fpUnzipExtract + '/test2PW', { pw }))
154
153
  console.log('unzip2 with password after')
155
154
  .catch((err) => {
156
155
  console.log(err)
157
156
  })
157
+ <pre class="prettyprint"><code>import wz from 'w-zip'
158
158
  //zipFile
159
159
  console.log('zipFile before')
160
160
  console.log('zipFile', await wz.mZip.zipFile(fpSrc1, fpZip1))
161
161
  console.log('zipFile after')
162
162
  //zipFolder
163
163
  console.log('zipFolder before')
164
164
  console.log('zipFolder', await wz.mZip.zipFolder(fpSrc2, fpZip2))
165
165
  console.log('zipFolder after')
166
166
  //zipFolder with password
167
167
  console.log('zipFolder with password before')
168
168
  console.log('zipFolder with password', await wz.mZip.zipFolder(fpSrc2, fpZip2PW, { pw }))
169
169
  console.log('zipFolder with password after')
170
170
  //unzip
171
171
  console.log('unzip1 before')
172
172
  console.log('unzip1', await wz.mZip.unzip(fpZip1, fpUnzipExtract + '/test1'))
173
173
  console.log('unzip1 after')
174
174
  //unzip
175
175
  console.log('unzip2 before')
176
176
  console.log('unzip2', await wz.mZip.unzip(fpZip2, fpUnzipExtract + '/test2'))
177
177
  console.log('unzip2 after')
178
178
  //unzip with password
179
179
  console.log('unzip2 with password before')
180
180
  console.log('unzip2 with password', await wz.mZip.unzip(fpZip2PW, fpUnzipExtract + '/test2PW', { pw }))
181
181
  console.log('unzip2 with password after')
182
182
  .catch((err) => {
183
183
  console.log(err)
184
184
  })
185
185
 
186
186
 
187
187
 
@@ -214,7 +214,7 @@
214
214
 
215
215
  <dt class="tag-source">Source:</dt>
216
216
  <dd class="tag-source"><ul class="dummy"><li>
217
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line278">line 278</a>
217
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line256">line 256</a>
218
218
  </li></ul></dd>
219
219
 
220
220
 
@@ -534,7 +534,7 @@
534
534
 
535
535
  <dt class="tag-source">Source:</dt>
536
536
  <dd class="tag-source"><ul class="dummy"><li>
537
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line107">line 107</a>
537
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line104">line 104</a>
538
538
  </li></ul></dd>
539
539
 
540
540
 
@@ -733,6 +733,8 @@
733
733
 
734
734
 
735
735
 
736
+ <th>Default</th>
737
+
736
738
 
737
739
  <th class="last">Description</th>
738
740
  </tr>
@@ -769,6 +771,12 @@
769
771
 
770
772
 
771
773
 
774
+ <td class="default">
775
+
776
+ <code>9</code>
777
+
778
+ </td>
779
+
772
780
 
773
781
  <td class="description last"><p>輸入壓縮程度整數,範圍為0至9,0為不壓縮而9為最高壓縮,預設9</p></td>
774
782
  </tr>
@@ -803,6 +811,10 @@
803
811
 
804
812
 
805
813
 
814
+ <td class="default">
815
+
816
+ </td>
817
+
806
818
 
807
819
  <td class="description last"><p>輸入壓縮密碼字串,預設''</p></td>
808
820
  </tr>
@@ -880,7 +892,7 @@
880
892
 
881
893
  <dt class="tag-source">Source:</dt>
882
894
  <dd class="tag-source"><ul class="dummy"><li>
883
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line192">line 192</a>
895
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line167">line 167</a>
884
896
  </li></ul></dd>
885
897
 
886
898
 
@@ -1085,7 +1097,7 @@
1085
1097
  <br class="clear">
1086
1098
 
1087
1099
  <footer>
1088
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Oct 07 2025 10:35:56 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1100
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat May 30 2026 20:38:46 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1089
1101
  </footer>
1090
1102
 
1091
1103
  <script>prettyPrint();</script>