Skip to content

Commit

Permalink
Add example of streaming only one file in the archive
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 authored Sep 20, 2024
1 parent 4b10876 commit d5d7b60
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ ZipWriter(filename) do w
end
```

### Streaming one entry in a large archive file
If your archive is in a file, `mmap` can be used to treat the file as a `Vector{UInt8}`

An entry can also be opened as an `IO` stream.

```julia
using ZipArchives: ZipReader, zip_openentry
using Downloads: download
using Mmap: mmap
zip_file_path = download("https://github.com/JuliaIO/ZipArchives.jl/archive/refs/heads/main.zip");
archive = ZipReader(mmap(open(zip_file_path)))
readme_n_lines = zip_openentry(archive, "ZipArchives.jl-main/README.md") do io
countlines(io)
end
```

### Supported Compression Methods

| Compression Method | Reading | Writing |
Expand Down

0 comments on commit d5d7b60

Please sign in to comment.