Copyright | © 2016 Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <markkarpov@openmailbox.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Types used by the package. You don't usually need to import this module, because Codec.Archive.Zip re-exports everything you may need, import that module instead.
- data EntrySelector
- mkEntrySelector :: MonadThrow m => Path Rel File -> m EntrySelector
- unEntrySelector :: EntrySelector -> Path Rel File
- getEntryName :: EntrySelector -> Text
- data EntrySelectorException = InvalidEntrySelector (Path Rel File)
- data EntryDescription = EntryDescription {}
- data CompressionMethod
- data ArchiveDescription = ArchiveDescription {}
- data ZipException
Entry selector
data EntrySelector Source
This data type serves for naming and selection of archive
entries. It can be created only with help of smart constructor
mkEntrySelector
, and it's the only “key” that can be used to select
files in archive or to name new files.
The abstraction is crucial for ensuring that created archives are portable across operating systems, file systems, and different platforms. Since on some operating systems, file paths are case-insensitive, this selector is also case-insensitive. It makes sure that only relative paths are used to name files inside archive, as it's recommended in the specification. It also guarantees that forward slashes are used when the path is stored inside archive for compatibility with Unix-like operating systems (as it is recommended in the specification). On the other hand, in can be rendered as ordinary relative file path in OS-specific format, when needed.
mkEntrySelector :: MonadThrow m => Path Rel File -> m EntrySelector Source
Create EntrySelector
from Path Rel File
. To avoid problems with
distribution of the archive, characters that some operating systems do
not expect in paths are not allowed. Proper paths should pass these
checks:
This function can throw EntrySelectorException
exception.
unEntrySelector :: EntrySelector -> Path Rel File Source
Make a relative path from EntrySelector
. Every EntrySelector
produces single Path Rel File
that corresponds to it.
getEntryName :: EntrySelector -> Text Source
Get entry name given EntrySelector
in from that is suitable for
writing to file header.
data EntrySelectorException Source
Exception describing various troubles you can have with
EntrySelector
.
InvalidEntrySelector (Path Rel File) | Selector cannot be created from this path |
Entry description
data EntryDescription Source
This record represents all information about archive entry that can be stored in a .ZIP archive. It does not mirror local file header or central directory file header, but their binary representation can be built given this date structure and actual archive contents.
EntryDescription | |
|
data CompressionMethod Source
Supported compression methods.
Archive desrciption
Exceptions
data ZipException Source
Bad things that can happen when you use the library.
EntryDoesNotExist (Path Abs File) EntrySelector | Thrown when you try to get contents of non-existing entry |
ParsingFailed (Path Abs File) String | Thrown when archive structure cannot be parsed |