zip icon indicating copy to clipboard operation
zip copied to clipboard

addFile StringStream fails on Windows

Open cark opened this issue 4 years ago • 1 comments

While this works fine on Linux, calling addFile with a StringStream parameter fails on Windows. The zip archive is created, but the enclosed file is 200MB+, and the archive cannot be uncompressed.

Here is a minimal example :

{.passl: "-lz".}
import zip/zipfiles
import streams

proc testZip() : void =
    var z : ZipArchive;
    var s = newStringStream("Hello world")
    if open(z, "test.zip", fmWrite):
        try:
            addFile(z, "datafile.txt", s)
        finally:
            close(z)

testZip()

On the other hand, creating zip files from on disk files works on both platforms.

cark avatar Aug 03 '19 04:08 cark