Packmatic (Packmatic v2.0.0)

View Source

Top-level module holding the Packmatic library, which provides Zip-oriented stream aggregation services from various sources.

Summary

Functions

Builds a Stream which can be consumed to construct a Zip file from various sources, as specified in the Manifest. When building the Stream, options can be passed to configure how the Encoder should behave when Source acquisition fails.

Functions

build_stream(target, options \\ [])

@spec build_stream(manifest | manifest_entries, options) :: Enumerable.t()
when manifest: Packmatic.Manifest.t(),
     manifest_entries: [
       Packmatic.Manifest.Entry.t() | Packmatic.Manifest.Entry.proplist(),
       ...
     ],
     options: [Packmatic.Encoder.option()]

Builds a Stream which can be consumed to construct a Zip file from various sources, as specified in the Manifest. When building the Stream, options can be passed to configure how the Encoder should behave when Source acquisition fails.

Examples

The Stream can be created by passing a Packmatic.Manifest.t/0 struct, a list of Manifest Entries (Packmatic.Manifest.Entry.t/0), or a list of Keyword Lists that are understood and can be transformed to Manifest Entries (Packmatic.Manifest.Entry.proplist/0).

iex(1)> stream = Packmatic.build_stream(Packmatic.Manifest.create())
iex(2)> is_function(stream)
true

iex(1)> stream = Packmatic.build_stream([])
iex(2)> is_function(stream)
true

iex(1)> stream = Packmatic.build_stream([[source: {:file, "foo.bar"}]])
iex(2)> is_function(stream)
true