node-zip-stream icon indicating copy to clipboard operation
node-zip-stream copied to clipboard

blank files should be stored

Open liuyuekeng opened this issue 4 years ago • 1 comments

If the empty file is not stored, using ZipInputStream to decompress will throw the following error:

    java.util.zip.ZipException: only DEFLATED entries can have EXT descriptor
    at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:310)
    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:122)
    at Alan.streamToUnzipFile(Alan.java:59)
    at Alan.main(Alan.java:29)

liuyuekeng avatar Apr 14 '20 12:04 liuyuekeng

https://github.com/archiverjs/node-compress-commons/blob/master/lib/archivers/zip/zip-archive-output-stream.js#L63 should already handle empty Buffers and strings. We dont know a streams length though until its fully consumed.

ctalkington avatar Nov 19 '20 02:11 ctalkington