Skip to content

An elixir library to write and read ZIP file in a streaming fashion

License

Notifications You must be signed in to change notification settings

StrongFennecs/zstream

 
 

Repository files navigation

Zstream

CI Module Version Hex Docs Total Download License Last Updated

An Elixir library to read and write ZIP file in a streaming fashion. It could consume data from any stream and write to any stream with constant memory overhead.

Installation

The package can be installed by adding :zstream to your list of dependencies in mix.exs:

def deps do
  [
    {:zstream, "~> 0.6"}
  ]
end

Examples

Zstream.zip([
  Zstream.entry("report.csv", Stream.map(records, &CSV.dump/1)),
  Zstream.entry("catfilm.mp4", File.stream!("/catfilm.mp4", [], 512), coder: Zstream.Coder.Stored)
])
|> Stream.into(File.stream!("/archive.zip"))
|> Stream.run
File.stream!("archive.zip", [], 512)
|> Zstream.unzip()
|> Enum.reduce(%{}, fn
  {:entry, %Zstream.Entry{name: file_name} = entry}, state -> state
  {:data, :eof}, state -> state
  {:data, data}, state -> state
end)

Features

zip

  • compression (deflate, stored)
  • encryption (traditional)
  • zip64

unzip

  • compression (deflate, stored)
  • zip64

License

Copyright (c) 2017 Anantha Kumaran

This library is MIT licensed. See the LICENSE for details.

About

An elixir library to write and read ZIP file in a streaming fashion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 98.1%
  • Ruby 1.4%
  • Nix 0.5%