Copyright | © 2016–present Mark Karpov |
---|---|
License | BSD 3 clause |
Maintainer | Mark Karpov <[email protected]> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | GHC2021 |
Codec.Archive.Zip.Internal.Type
Description
Types used by the package.
Synopsis
- data EntrySelector
- mkEntrySelector :: MonadThrow m => FilePath -> m EntrySelector
- unEntrySelector :: EntrySelector -> FilePath
- getEntryName :: EntrySelector -> Text
- newtype EntrySelectorException = InvalidEntrySelector FilePath
- 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 the help of the smart constructor
mkEntrySelector
, and it's the only “key” that can be used to refer to
files in the archive or to name new archive entries.
The abstraction is crucial for ensuring that created archives are portable across operating systems, file systems, and 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 the archive for compatibility with Unix-like operating systems (as recommended in the specification). On the other hand, in can be rendered as an ordinary relative file path in OS-specific format when needed.
Instances
Show EntrySelector Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods showsPrec :: Int -> EntrySelector -> ShowS # show :: EntrySelector -> String # showList :: [EntrySelector] -> ShowS # | |
Eq EntrySelector Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods (==) :: EntrySelector -> EntrySelector -> Bool # (/=) :: EntrySelector -> EntrySelector -> Bool # | |
Ord EntrySelector Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods compare :: EntrySelector -> EntrySelector -> Ordering # (<) :: EntrySelector -> EntrySelector -> Bool # (<=) :: EntrySelector -> EntrySelector -> Bool # (>) :: EntrySelector -> EntrySelector -> Bool # (>=) :: EntrySelector -> EntrySelector -> Bool # max :: EntrySelector -> EntrySelector -> EntrySelector # min :: EntrySelector -> EntrySelector -> EntrySelector # |
mkEntrySelector :: MonadThrow m => FilePath -> m EntrySelector Source #
Create an EntrySelector
from a FilePath
. To avoid problems with
distribution of the archive, characters that some operating systems do
not expect in paths are not allowed.
Argument to mkEntrySelector
should pass these checks:
isValid
isValid
- it is a relative path without slash at the end
- binary representations of normalized path should be not longer than 65535 bytes
This function can throw an EntrySelectorException
.
unEntrySelector :: EntrySelector -> FilePath Source #
Restore a relative path from EntrySelector
. Every EntrySelector
corresponds to a FilePath
.
getEntryName :: EntrySelector -> Text Source #
Get an entry name in the from that is suitable for writing to file
header, given an EntrySelector
.
newtype EntrySelectorException Source #
The problems you can have with an EntrySelector
.
Constructors
InvalidEntrySelector FilePath |
|
Instances
Entry description
data EntryDescription Source #
The 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 representations can be built given this data structure and the archive contents.
Constructors
EntryDescription | |
Fields
|
Instances
Show EntryDescription Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods showsPrec :: Int -> EntryDescription -> ShowS # show :: EntryDescription -> String # showList :: [EntryDescription] -> ShowS # | |
Eq EntryDescription Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods (==) :: EntryDescription -> EntryDescription -> Bool # (/=) :: EntryDescription -> EntryDescription -> Bool # |
data CompressionMethod Source #
The supported compression methods.
Constructors
Store | Store file uncompressed |
Deflate | Deflate |
BZip2 | Compressed using BZip2 algorithm |
Zstd | Compressed using Zstandard algorithm Since: 1.6.0 |
Instances
Archive description
data ArchiveDescription Source #
The information about the archive as a whole.
Constructors
ArchiveDescription | |
Instances
Exceptions
data ZipException Source #
The bad things that can happen when you use the library.
Constructors
EntryDoesNotExist FilePath EntrySelector | Thrown when you try to get contents of non-existing entry |
UnsupportedCompressionMethod CompressionMethod | Thrown when attempting to decompress an entry compressed with an unsupported compression method or the library is compiled without support for it. Since: 2.0.0 |
ParsingFailed FilePath String | Thrown when archive structure cannot be parsed. |
Instances
Exception ZipException Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods toException :: ZipException -> SomeException # fromException :: SomeException -> Maybe ZipException # displayException :: ZipException -> String # backtraceDesired :: ZipException -> Bool # | |
Show ZipException Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods showsPrec :: Int -> ZipException -> ShowS # show :: ZipException -> String # showList :: [ZipException] -> ShowS # | |
Eq ZipException Source # | |
Defined in Codec.Archive.Zip.Internal.Type | |
Ord ZipException Source # | |
Defined in Codec.Archive.Zip.Internal.Type Methods compare :: ZipException -> ZipException -> Ordering # (<) :: ZipException -> ZipException -> Bool # (<=) :: ZipException -> ZipException -> Bool # (>) :: ZipException -> ZipException -> Bool # (>=) :: ZipException -> ZipException -> Bool # max :: ZipException -> ZipException -> ZipException # min :: ZipException -> ZipException -> ZipException # |