Closed byt3bl33d3r closed 3 years ago
I believe the issue here is you are attempting to directly uncompres the .zip file you read with var z = uncompress(pyzip)
. A zip file is actually many small compressed blobs for each individual file so that does not work. All you need to do in this case is use extractAll(zipPath, tmpdir) with no uncompress beforehand. extractAll will handle the uncompressing.
Something like: extractAll("../rsrc/python-3.9.1-embed-amd64.zip", tmpdir)
So in this particular case pyzip
is an embedded resource that gets put in memory at compile time (not the location of a file). From what I've read extractAll
can only extract files from disk not from memory.
If i don't call uncompress
first and just do a extractAll(pyzip, tmpdir)
I get the following error:
Ah ok. I do not have an API for opening zip archives in memory since I didn't think that'd be something that would be needed. For now you'll need to write it to disk as a temp file somewhere to use Zippy.
Rereading, it sounds like you are embedding that zip archive into the compilation of your program? My answer about Zippy not supporting that for zip archives / tarballs is still true but obviously writing a temp file won't help.
Gotcha, Yeah in this particular case the ability to extract zip files from memory to disk would be very useful. I don't think there's a good library to do that in Nim. The official zip library doesn't seem to work when x-compiled to windows.
I have tagged release 0.5.4 https://github.com/guzba/zippy/releases/tag/0.5.4 which includes the PR adding support for this. Closing this issue now as I think we're good. Feel free to re-open if we're not actually ready to here just yet.
Heya,
First off, thanks a ton for this library.
I'm not exactly sure what I'm doing wrong here, I have the following code:
I'm cross compiling to Windows from MacOS using Mingw. The above code produces the following error when run:
Does zippy not support decompressing zip files this way?
Thanks