zstream v0.1.1 Zstream View Source

Module for creating ZIP file stream

Example

Zstream.create([
  Zstream.entry("report.csv", Stream.map(records, &CSV.dump/1)),
  Zstream.entry("catfilm.mp4", File.stream!("/catfilm.mp4"), coder: Zstream.Coder.Stored)
])
|> Stream.into(File.stream!("/archive.zip"))
|> Stream.run

Link to this section Summary

Functions

Creates a ZIP file stream

Creates a ZIP file entry with the given name

Link to this section Types

Link to this section Functions

Creates a ZIP file stream

entries are consumed one by one in the given order

Link to this function entry(name, enum, options \\ []) View Source
entry(String.t(), Enumerable.t(), Keyword.t()) :: entry()

Creates a ZIP file entry with the given name

The enum could be either lazy Stream or List. The elements in enum should be of type iodata

Options

  • :coder (module | {module, list}) - The compressor that should be used to encode the data. Available options are

    Zstream.Coder.Deflate - use deflate compression

    Zstream.Coder.Stored - store without any compression

    Defaults to Zstream.Coder.Deflate

  • :mtime (DateTime) - File last modication time. Defaults to system local time.