# Packmatic v2.1.0 - Table of Contents

> Streaming Zip64 archive generation

## Pages

- [Packmatic](readme.md)
- [Changelog](changelog.md)

## Modules

- [Packmatic](Packmatic.md): Top-level module holding the Packmatic library, which provides Zip-oriented stream aggregation
services from various sources.

- [Packmatic.Compressor](Packmatic.Compressor.md): The Compressor is responsible for compressing source data for placement into the Zip archive.
The Zip format supports different types of compression methods, so many different Compressors
can be created, as long as they conform to the behaviour.

- [Packmatic.Encoder](Packmatic.Encoder.md): Holds logic which can be used to put together a Zip file in an interative fashion, suitable for
wrapping within a `Stream`. The format of Zip files emitted by `Packmatic.Encoder` is documented
under the modules implementing the `Packmatic.Field` protocol.
- [Packmatic.Manifest](Packmatic.Manifest.md): Represents the customer’s request for a particular compressed file.
- [Packmatic.Source](Packmatic.Source.md): Defines how data can be acquired in a piecemeal fashion, perhaps by reading only a few pages
from the disk at a time or only a few MBs of data from an open socket.
- [Packmatic.Compressor.Deflate](Packmatic.Compressor.Deflate.md): Provides “DEFLATE” compression method for use in Zip archives, which compresses
the incoming data stream.
- [Packmatic.Compressor.Store](Packmatic.Compressor.Store.md): Provides “STORE” compression method for use in Zip archives. The “STORE” method does not
actually compress the incoming data stream.

- [Packmatic.Manifest.Entry](Packmatic.Manifest.Entry.md): Represents a particular file that will go into package, which is sourced by reading from a file,
downloading from an URI, etc.
- [Packmatic.Manifest.Entry.Attributes](Packmatic.Manifest.Entry.Attributes.md): The Manifest Entry Attributes represents the file’s UNIX and DOS attributes,
such as UID, GID, sticky bit, UNIX permissions (`0o777` aka `rwxrwxrwx`, etc),
in a way that is easy to specify.
- [Packmatic.Source.Dynamic](Packmatic.Source.Dynamic.md): Represents content which may be generated on-demand, for example by another subsystem or via
downloading from a signed URL.
- [Packmatic.Source.File](Packmatic.Source.File.md): Represents content on disk, for example from a static file. Also useful for content generated
ahead of time.

- [Packmatic.Source.Random](Packmatic.Source.Random.md): Represents randomly generated content, which is used mostly for testing, when you want to have a
particular entry generated to a specific length.

- [Packmatic.Source.Stream](Packmatic.Source.Stream.md): Represents content generated by enumerating a Stream, which returns IO Lists.
- [Packmatic.Source.URL](Packmatic.Source.URL.md): Represents content which can be acquired by downloading from a remote server via HTTP(S) in
chunks. Each chunk is then pulled away by the Encoder, which is iterated by the Stream.

- Events
  - [Packmatic.Event](Packmatic.Event.md): Represents Events that can be raised during the lifecycle of a Packmatic Stream being consumed.
  - [Packmatic.Event.EntryCompleted](Packmatic.Event.EntryCompleted.md): Represents an Event that is raised when the Encoder has completed reading from the Entry, i.e.
when the Source has returned EOF.

  - [Packmatic.Event.EntryFailed](Packmatic.Event.EntryFailed.md): Represents an Event that is raised when the Encoder has failed to read from the Entry, i.e.
when the Source has returned an error. Depending on the options, the Stream may continue to
encode or it may halt.

  - [Packmatic.Event.EntryStarted](Packmatic.Event.EntryStarted.md): Represents an Event that is raised when the Encoder starts reading from a new Entry. The Entry
is the same one as passed in the Manifest.

  - [Packmatic.Event.EntryUpdated](Packmatic.Event.EntryUpdated.md): Represents an Event that is raised when the Encoder has made progress reading from the Entry.
Usually, the Source will read iteratively so this messge can be raised quite frequently.

  - [Packmatic.Event.StreamEnded](Packmatic.Event.StreamEnded.md): Represents an Event that is raised when the Encoder completes work. In case of normal
completion, the reason will be set to `:done`, otherwise and in case of Source errors, the
reason will be carried across. 

  - [Packmatic.Event.StreamStarted](Packmatic.Event.StreamStarted.md): Represents an Event that is raised when a new copy of Encoder, and therefore a new Stream, is
started against the Manifest.

- Data Structs
  - [Packmatic.Field](Packmatic.Field.md): Represents data fields used internally by `Packmatic.Encoder` to build the Zip archive.

  - [Packmatic.Field.Central.DirectoryEnd](Packmatic.Field.Central.DirectoryEnd.md): Represents the End of Central Directory record.
  - [Packmatic.Field.Central.FileHeader](Packmatic.Field.Central.FileHeader.md): Represents the Central Directory File Header, which is part of the Central Directory at the
end of the archive.
  - [Packmatic.Field.Local.DataDescriptor](Packmatic.Field.Local.DataDescriptor.md): Represents the Data Descriptor, which is used to facilitate streaming. This is requried since
Packmatic assembles the files on the fly, so it does not know the size until the entire source
has been read.
  - [Packmatic.Field.Local.FileHeader](Packmatic.Field.Local.FileHeader.md): Represents the Local File Header, which is emitted before the content of each file is
incorporated into the Zip stream.
  - [Packmatic.Field.Shared.ExtendedInformation](Packmatic.Field.Shared.ExtendedInformation.md): Represents the Zip64 Extended Information Extra Field, which can be emitted in both Local and
Central File Headers, but in practice only used in the Central File Header within Packmatic, due
to its streaming nature.
  - [Packmatic.Field.Shared.ExtendedTimestamp](Packmatic.Field.Shared.ExtendedTimestamp.md): Represents the Extended Timestamp Extra Field, which is emitted in both Local and Central File
Headers. The field is emitted with only the modification time, in seconds since UNIX epoch
(1 January, 1970).
  - [Packmatic.Field.Shared.Timestamp](Packmatic.Field.Shared.Timestamp.md): The Shared Timestamp field is emitted in both Local and Central File Headers, and is emitted in
DOS (FAT) format.
  - [Packmatic.Field.Shared.Unix](Packmatic.Field.Shared.Unix.md): Represents the Info-ZIP New Unix Extra Field, which is emitted in the Central File
Headers. The field is emitted only when both the UID and GID are set via the
Entry Attributes, otherwise it will not be emitted. The size is 4 bytes for both the
UID and GID, same as what Erlang’s zip module emits.

- Auxiliary Modules
  - [Packmatic.Buffer](Packmatic.Buffer.md): The Buffer provides blocking writes and blocking reads to a pre-defined I/O buffer,
which is suitable for applying backpressure to content loaded from servers.
  - [Packmatic.Conn](Packmatic.Conn.md): Contains convenience functions which can be used to easily integrate a Zip stream with
Plug-using applications such as Phoenix.

- Exceptions
  - [Packmatic.StreamError](Packmatic.StreamError.md)

