# Download decompressed .zip-archive from url

**URL:** <https://discourse.julialang.org/t/download-decompressed-zip-archive-from-url/107452>\
**Category:** New to Julia\
**Tags:** http, zip\
**Created:** [December 11, 2023, 3:42pm UTC](https://discourse.julialang.org/t/download-decompressed-zip-archive-from-url/107452 "2023-12-11T15:42:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maximikos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maximikos/32/31005_2.png) [@maximikos](https://discourse.julialang.org/u/maximikos)\
**Post date:** [December 11, 2023, 3:42pm UTC](https://discourse.julialang.org/t/download-decompressed-zip-archive-from-url/107452/1 "2023-12-11T15:42:49Z")

</div>

Hi,

I would like to extract and download files from a .zip-archive stored online ([here](https://zenodo.org/records/5589597/files/IOT_1995_pxp.zip)) without having to download intermediate files. The .zip-archive consists of .txt and .json files and is nested.

I have found two references that work for .tar-files (on [Discourse](https://discourse.julialang.org/t/how-to-plumb-together-download-uncompress-untar-without-writing-full-downloaded-file/76668) and [reddit](https://www.reddit.com/r/Julia/comments/rj48a4/what_is_the_best_way_to_download_and_extract/)) but I cannot figure out how I would have to do it for .zip-folders. In the reddit post, the package [UrlDownload.jl](https://github.com/Arkoniak/UrlDownload.jl) was suggested; this does not work in this case, returning multiple warnings: “Data format unknown is not supported.”

So far, I have been trying multiple variations along the lines of something like:

```julia
using HTTP, ZipFile

unzip_from_url(link, dir) = HTTP.open("GET", link) do io
    zarchive = ZipFile.Reader(io)
    for f in zarchive.files
        FileName = split(f.name, "/")
        DirName = joinpath(FileName[Not(end)]...)
        FilePath = joinpath(dir, DirName)
        if FileName[end] == ""
            mkdir(FilePath)
        else
            mkpath(FilePath)
            p = joinpath(dir, FileName...)
            write(p, read(f))
        end
    end
    close(zarchive)
end

```

The reason for why I don’t want to download the .zip-archive first and then extract it locally is that there are multiple such archives at the above url, each with around 700 MB and for a single year, and I don’t want to have to store both the zipped folders and the extracted ones.

---

<div class="post-metadata">

**Author:** ![mrufsvold](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrufsvold/32/31600_2.png) [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Post date:** [December 11, 2023, 6:11pm UTC](https://discourse.julialang.org/t/download-decompressed-zip-archive-from-url/107452/2 "2023-12-11T18:11:28Z")

</div>

You might benefit from ZipStreams.jl!
