zip-2.2.1: Operations on zip archives
Copyright© 2016–present Mark Karpov
LicenseBSD 3 clause
MaintainerMark Karpov <[email protected]>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageGHC2021

Codec.Archive.Zip.Internal.Type

Description

Types used by the package.

Synopsis

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.

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

EntrySelector cannot be created from this path

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

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

Instances details
Data CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CompressionMethod -> c CompressionMethod #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CompressionMethod #

toConstr :: CompressionMethod -> Constr #

dataTypeOf :: CompressionMethod -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CompressionMethod) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompressionMethod) #

gmapT :: (forall b. Data b => b -> b) -> CompressionMethod -> CompressionMethod #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CompressionMethod -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CompressionMethod -> r #

gmapQ :: (forall d. Data d => d -> u) -> CompressionMethod -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CompressionMethod -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CompressionMethod -> m CompressionMethod #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CompressionMethod -> m CompressionMethod #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CompressionMethod -> m CompressionMethod #

Bounded CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Enum CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Read CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Show CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Eq CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Ord CompressionMethod Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Archive description

data ArchiveDescription Source #

The information about the archive as a whole.

Constructors

ArchiveDescription 

Fields

Instances

Instances details
Data ArchiveDescription Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArchiveDescription -> c ArchiveDescription #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArchiveDescription #

toConstr :: ArchiveDescription -> Constr #

dataTypeOf :: ArchiveDescription -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ArchiveDescription) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArchiveDescription) #

gmapT :: (forall b. Data b => b -> b) -> ArchiveDescription -> ArchiveDescription #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArchiveDescription -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArchiveDescription -> r #

gmapQ :: (forall d. Data d => d -> u) -> ArchiveDescription -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ArchiveDescription -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArchiveDescription -> m ArchiveDescription #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArchiveDescription -> m ArchiveDescription #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArchiveDescription -> m ArchiveDescription #

Read ArchiveDescription Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Show ArchiveDescription Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Eq ArchiveDescription Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

Ord ArchiveDescription Source # 
Instance details

Defined in Codec.Archive.Zip.Internal.Type

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.