w-zip 1.0.41 → 1.0.43

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/docs/m7z.mjs.html CHANGED
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="m7z.html">m7z</a><ul class='methods'><li data-type='method'><a href="m7z.html#.setProg">setProg</a></li><li data-type='method'><a href="m7z.html#.unzip">unzip</a></li><li data-type='method'><a href="m7z.html#.zipFile">zipFile</a></li><li data-type='method'><a href="m7z.html#.zipFolder">zipFolder</a></li></ul></li><li><a href="mZip.html">mZip</a><ul class='methods'><li data-type='method'><a href="mZip.html#.unzip">unzip</a></li><li data-type='method'><a href="mZip.html#.zipFile">zipFile</a></li><li data-type='method'><a href="mZip.html#.zipFolder">zipFolder</a></li></ul></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="m7z.html">m7z</a><ul class='methods'><li data-type='method'><a href="m7z.html#.setProg">setProg</a></li><li data-type='method'><a href="m7z.html#.unzip">unzip</a></li><li data-type='method'><a href="m7z.html#.zipFile">zipFile</a></li><li data-type='method'><a href="m7z.html#.zipFolder">zipFolder</a></li></ul></li><li><a href="mZip.html">mZip</a><ul class='methods'><li data-type='method'><a href="mZip.html#.listEntries">listEntries</a></li><li data-type='method'><a href="mZip.html#.readEntry">readEntry</a></li><li data-type='method'><a href="mZip.html#.unzip">unzip</a></li><li data-type='method'><a href="mZip.html#.zipFile">zipFile</a></li><li data-type='method'><a href="mZip.html#.zipFolder">zipFolder</a></li></ul></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -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.5</a> on Tue Sep 22 2026 18:34:49 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 Fri Oct 02 2026 15:37:30 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
@@ -29,7 +29,7 @@
29
29
  <nav >
30
30
 
31
31
 
32
- <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="m7z.html">m7z</a><ul class='methods'><li data-type='method'><a href="m7z.html#.setProg">setProg</a></li><li data-type='method'><a href="m7z.html#.unzip">unzip</a></li><li data-type='method'><a href="m7z.html#.zipFile">zipFile</a></li><li data-type='method'><a href="m7z.html#.zipFolder">zipFolder</a></li></ul></li><li><a href="mZip.html">mZip</a><ul class='methods'><li data-type='method'><a href="mZip.html#.unzip">unzip</a></li><li data-type='method'><a href="mZip.html#.zipFile">zipFile</a></li><li data-type='method'><a href="mZip.html#.zipFolder">zipFolder</a></li></ul></li></ul>
32
+ <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="m7z.html">m7z</a><ul class='methods'><li data-type='method'><a href="m7z.html#.setProg">setProg</a></li><li data-type='method'><a href="m7z.html#.unzip">unzip</a></li><li data-type='method'><a href="m7z.html#.zipFile">zipFile</a></li><li data-type='method'><a href="m7z.html#.zipFolder">zipFolder</a></li></ul></li><li><a href="mZip.html">mZip</a><ul class='methods'><li data-type='method'><a href="mZip.html#.listEntries">listEntries</a></li><li data-type='method'><a href="mZip.html#.readEntry">readEntry</a></li><li data-type='method'><a href="mZip.html#.unzip">unzip</a></li><li data-type='method'><a href="mZip.html#.zipFile">zipFile</a></li><li data-type='method'><a href="mZip.html#.zipFolder">zipFolder</a></li></ul></li></ul>
33
33
 
34
34
  </nav>
35
35
 
@@ -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#line90">line 90</a>
83
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line121">line 121</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
  //listEntries
183
183
  console.log('listEntries before')
184
184
  console.log('listEntries', (await wz.mZip.listEntries(fpZip2)).map((v) => v.filename))
185
185
  console.log('listEntries after')
186
186
  //readEntry
187
187
  console.log('readEntry before')
188
188
  console.log('readEntry', JSON.parse(await wz.mZip.readEntry(fpZip1, 'file1(中文).txt')).name)
189
189
  console.log('readEntry after')
190
190
  //readEntry with password
191
191
  console.log('readEntry with password before')
192
192
  console.log('readEntry with password', (await wz.mZip.readEntry(fpZip2PW, 'folder1/f1-1.xlsx', { type: 'u8', pw })).length)
193
193
  console.log('readEntry with password after')
194
194
  .catch((err) => {
195
195
  console.log(err)
196
196
  })
197
197
 
198
198
 
199
199
 
@@ -150,7 +150,7 @@
150
150
 
151
151
 
152
152
  <div class="param-desc">
153
- <p>回傳壓縮物件,可使用函數zipFile、zipFolder、unzip</p>
153
+ <p>回傳壓縮物件,可使用函數zipFile、zipFolder、unzip、listEntries、readEntry</p>
154
154
  </div>
155
155
 
156
156
 
@@ -198,6 +198,539 @@
198
198
 
199
199
 
200
200
 
201
+ <h4 class="name" id=".listEntries"><span class="type-signature type-signature-async, static">(async, static) </span>listEntries<span class="signature">(src)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
202
+
203
+
204
+
205
+
206
+
207
+
208
+ <dl class="details">
209
+
210
+ <dt class="tag-description">Description:</dt>
211
+ <dd class="tag-description"><ul class="dummy"><li><p>列出壓縮檔內項目,不解壓至資料夾</p>
212
+ <p>加密之壓縮檔不需密碼即可列出。含不安全路徑(例如'../'、絕對路徑、磁碟代號)項目之壓縮檔會整個reject。
213
+ 項目名以''分隔者會正規化為'/'。項目名未標示UTF-8且無Unicode路徑欄位者(例如部分工具以Big5寫入),依zip.js預設以CP437解碼,名稱會呈現亂碼,讀取時須使用回傳之名稱。</p></li></ul></dd>
214
+
215
+
216
+
217
+ <dt class="tag-source">Source:</dt>
218
+ <dd class="tag-source"><ul class="dummy"><li>
219
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line455">line 455</a>
220
+ </li></ul></dd>
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ </dl>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+ <h5 class="h5-parameters">Parameters:</h5>
267
+
268
+
269
+ <table class="params">
270
+ <thead>
271
+ <tr>
272
+
273
+ <th>Name</th>
274
+
275
+
276
+ <th>Type</th>
277
+
278
+
279
+
280
+
281
+
282
+ <th class="last">Description</th>
283
+ </tr>
284
+ </thead>
285
+
286
+ <tbody>
287
+
288
+
289
+ <tr>
290
+
291
+ <td class="name"><code>src</code></td>
292
+
293
+
294
+ <td class="type">
295
+
296
+
297
+ <span class="param-type">String</span>
298
+ |
299
+
300
+ <span class="param-type">Buffer</span>
301
+ |
302
+
303
+ <span class="param-type">Uint8Array</span>
304
+
305
+
306
+
307
+
308
+ </td>
309
+
310
+
311
+
312
+
313
+
314
+ <td class="description last"><p>輸入壓縮檔案位置字串,或壓縮檔內容之Buffer、Uint8Array,給予檔案位置時只讀取中央目錄而不載入整個檔案</p></td>
315
+ </tr>
316
+
317
+
318
+ </tbody>
319
+ </table>
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+ <h5 class="h5-returns">Returns:</h5>
337
+
338
+
339
+ <div class="param-desc">
340
+ <p>回傳Promise,resolve為項目陣列,依壓縮檔中央目錄順序,各項目為{filename,directory,uncompressedSize,compressedSize,encrypted,lastModDate},filename為壓縮檔內以'/'分隔之路徑,reject為失敗資訊</p>
341
+ </div>
342
+
343
+
344
+
345
+ <dl class="param-type">
346
+ <dt>
347
+ Type
348
+ </dt>
349
+ <dd>
350
+
351
+ <span class="param-type">Promise</span>
352
+
353
+
354
+
355
+ </dd>
356
+ </dl>
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+ <h4 class="name" id=".readEntry"><span class="type-signature type-signature-async, static">(async, static) </span>readEntry<span class="signature">(src, filename, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
368
+
369
+
370
+
371
+
372
+
373
+
374
+ <dl class="details">
375
+
376
+ <dt class="tag-description">Description:</dt>
377
+ <dd class="tag-description"><ul class="dummy"><li><p>讀取壓縮檔內單一項目,不解壓至資料夾</p>
378
+ <p>讀出內容會驗證CRC32,資料損毀或密碼錯誤時reject。含不安全路徑(例如'../'、絕對路徑、磁碟代號)項目之壓縮檔會整個reject。</p></li></ul></dd>
379
+
380
+
381
+
382
+ <dt class="tag-source">Source:</dt>
383
+ <dd class="tag-source"><ul class="dummy"><li>
384
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line501">line 501</a>
385
+ </li></ul></dd>
386
+
387
+
388
+
389
+
390
+
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+
402
+
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+ </dl>
418
+
419
+
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+ <h5 class="h5-parameters">Parameters:</h5>
432
+
433
+
434
+ <table class="params">
435
+ <thead>
436
+ <tr>
437
+
438
+ <th>Name</th>
439
+
440
+
441
+ <th>Type</th>
442
+
443
+
444
+ <th>Attributes</th>
445
+
446
+
447
+
448
+ <th>Default</th>
449
+
450
+
451
+ <th class="last">Description</th>
452
+ </tr>
453
+ </thead>
454
+
455
+ <tbody>
456
+
457
+
458
+ <tr>
459
+
460
+ <td class="name"><code>src</code></td>
461
+
462
+
463
+ <td class="type">
464
+
465
+
466
+ <span class="param-type">String</span>
467
+ |
468
+
469
+ <span class="param-type">Buffer</span>
470
+ |
471
+
472
+ <span class="param-type">Uint8Array</span>
473
+
474
+
475
+
476
+
477
+ </td>
478
+
479
+
480
+ <td class="attributes">
481
+
482
+
483
+
484
+
485
+
486
+ </td>
487
+
488
+
489
+
490
+ <td class="default">
491
+
492
+ </td>
493
+
494
+
495
+ <td class="description last"><p>輸入壓縮檔案位置字串,或壓縮檔內容之Buffer、Uint8Array,給予檔案位置時只讀取中央目錄與該項目而不載入整個檔案</p></td>
496
+ </tr>
497
+
498
+
499
+
500
+ <tr>
501
+
502
+ <td class="name"><code>filename</code></td>
503
+
504
+
505
+ <td class="type">
506
+
507
+
508
+ <span class="param-type">String</span>
509
+
510
+
511
+
512
+
513
+ </td>
514
+
515
+
516
+ <td class="attributes">
517
+
518
+
519
+
520
+
521
+
522
+ </td>
523
+
524
+
525
+
526
+ <td class="default">
527
+
528
+ </td>
529
+
530
+
531
+ <td class="description last"><p>輸入項目路徑字串,須與listEntries回傳之filename完全相同(以'/'分隔且區分大小寫),若有同名項目則取最後一筆</p></td>
532
+ </tr>
533
+
534
+
535
+
536
+ <tr>
537
+
538
+ <td class="name"><code>opt</code></td>
539
+
540
+
541
+ <td class="type">
542
+
543
+
544
+ <span class="param-type">Object</span>
545
+
546
+
547
+
548
+
549
+ </td>
550
+
551
+
552
+ <td class="attributes">
553
+
554
+ &lt;optional><br>
555
+
556
+
557
+
558
+
559
+
560
+ </td>
561
+
562
+
563
+
564
+ <td class="default">
565
+
566
+ <code>{}</code>
567
+
568
+ </td>
569
+
570
+
571
+ <td class="description last"><p>輸入設定物件,預設{}</p>
572
+ <h6>Properties</h6>
573
+
574
+
575
+ <table class="params">
576
+ <thead>
577
+ <tr>
578
+
579
+ <th>Name</th>
580
+
581
+
582
+ <th>Type</th>
583
+
584
+
585
+ <th>Attributes</th>
586
+
587
+
588
+
589
+ <th>Default</th>
590
+
591
+
592
+ <th class="last">Description</th>
593
+ </tr>
594
+ </thead>
595
+
596
+ <tbody>
597
+
598
+
599
+ <tr>
600
+
601
+ <td class="name"><code>type</code></td>
602
+
603
+
604
+ <td class="type">
605
+
606
+
607
+ <span class="param-type">String</span>
608
+
609
+
610
+
611
+
612
+ </td>
613
+
614
+
615
+ <td class="attributes">
616
+
617
+ &lt;optional><br>
618
+
619
+
620
+
621
+
622
+
623
+ </td>
624
+
625
+
626
+
627
+ <td class="default">
628
+
629
+ <code>'text'</code>
630
+
631
+ </td>
632
+
633
+
634
+ <td class="description last"><p>輸入回傳資料型態字串,可選'text'為UTF-8解碼之字串(去除BOM)、'u8'為Uint8Array,非UTF-8之文字內容請用'u8'自行解碼,預設'text'</p></td>
635
+ </tr>
636
+
637
+
638
+
639
+ <tr>
640
+
641
+ <td class="name"><code>pw</code></td>
642
+
643
+
644
+ <td class="type">
645
+
646
+
647
+ <span class="param-type">String</span>
648
+
649
+
650
+
651
+
652
+ </td>
653
+
654
+
655
+ <td class="attributes">
656
+
657
+ &lt;optional><br>
658
+
659
+
660
+
661
+
662
+
663
+ </td>
664
+
665
+
666
+
667
+ <td class="default">
668
+
669
+ <code>''</code>
670
+
671
+ </td>
672
+
673
+
674
+ <td class="description last"><p>輸入解壓縮密碼字串,預設''</p></td>
675
+ </tr>
676
+
677
+
678
+ </tbody>
679
+ </table>
680
+
681
+ </td>
682
+ </tr>
683
+
684
+
685
+ </tbody>
686
+ </table>
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+
696
+
697
+
698
+
699
+
700
+
701
+
702
+
703
+ <h5 class="h5-returns">Returns:</h5>
704
+
705
+
706
+ <div class="param-desc">
707
+ <p>回傳Promise,resolve為項目內容之字串或Uint8Array,reject為失敗資訊,找不到項目或項目為資料夾時亦為reject</p>
708
+ </div>
709
+
710
+
711
+
712
+ <dl class="param-type">
713
+ <dt>
714
+ Type
715
+ </dt>
716
+ <dd>
717
+
718
+ <span class="param-type">Promise</span>
719
+
720
+
721
+
722
+ </dd>
723
+ </dl>
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
201
734
  <h4 class="name" id=".unzip"><span class="type-signature type-signature-async, static">(async, static) </span>unzip<span class="signature">(fpSrc, fpTar, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
202
735
 
203
736
 
@@ -214,7 +747,7 @@
214
747
 
215
748
  <dt class="tag-source">Source:</dt>
216
749
  <dd class="tag-source"><ul class="dummy"><li>
217
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line256">line 256</a>
750
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line287">line 287</a>
218
751
  </li></ul></dd>
219
752
 
220
753
 
@@ -534,7 +1067,7 @@
534
1067
 
535
1068
  <dt class="tag-source">Source:</dt>
536
1069
  <dd class="tag-source"><ul class="dummy"><li>
537
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line104">line 104</a>
1070
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line135">line 135</a>
538
1071
  </li></ul></dd>
539
1072
 
540
1073
 
@@ -892,7 +1425,7 @@
892
1425
 
893
1426
  <dt class="tag-source">Source:</dt>
894
1427
  <dd class="tag-source"><ul class="dummy"><li>
895
- <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line167">line 167</a>
1428
+ <a href="mZip.mjs.html">mZip.mjs</a>, <a href="mZip.mjs.html#line198">line 198</a>
896
1429
  </li></ul></dd>
897
1430
 
898
1431
 
@@ -1097,7 +1630,7 @@
1097
1630
  <br class="clear">
1098
1631
 
1099
1632
  <footer>
1100
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Tue Sep 22 2026 18:34:49 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1633
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri Oct 02 2026 15:37:30 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1101
1634
  </footer>
1102
1635
 
1103
1636
  <script>prettyPrint();</script>