streamly-zip-0.0.1: Stream data from zip archives using the streamly library.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.External.Zip

Synopsis

Open archive

data Zip Source #

A zip archive.

data OpenFlag Source #

Constructors

O_CHECKCONS

Perform additional stricter consistency checks on the archive, and error if they fail.

Instances

Instances details
Eq OpenFlag Source # 
Instance details

Defined in Streamly.External.Zip.Internal

Ord OpenFlag Source # 
Instance details

Defined in Streamly.External.Zip.Internal

openZip :: FilePath -> [OpenFlag] -> IO Zip Source #

Opens the zip archive at the given file path.

Warning: To satisfy low-level libzip requirements, please use each Zip from one thread only—or make sure to synchronize its use. Note that it is perfectly fine to open multiple Zips for a single zip file on disk.

Archive information

getNumEntries :: Zip -> IO Int Source #

Gets the number of entries in the given archive.

Paths

data PathFlag Source #

Constructors

P_FL_ENC_RAW

Return the unmodified names as it is in the ZIP archive.

P_FL_ENC_GUESS

(Default.) Guess the encoding of the name in the ZIP archive and convert it to UTF-8, if necessary. (Only CP-437 and UTF-8 are recognized.)

P_FL_ENC_STRICT

Follow the ZIP specification and expect CP-437 encoded names in the ZIP archive (except if they are explicitly marked as UTF-8). Convert it to UTF-8.

Instances

Instances details
Eq PathFlag Source # 
Instance details

Defined in Streamly.External.Zip.Internal

Ord PathFlag Source # 
Instance details

Defined in Streamly.External.Zip.Internal

getPathByIndex :: Zip -> Int -> [PathFlag] -> IO ByteString Source #

Gets the path (e.g., "foo.txt", "foo/", or "foo/bar.txt") of the file at the given 0-based index in the given zip archive. Please use getNumEntries to find the upper bound for the index.

Streamly

data GetFileFlag Source #

Constructors

GF_FL_COMPRESSED

Read the compressed data. Otherwise the data is uncompressed when reading.

unfoldFileAtPath :: MonadIO m => Unfold m (Zip, [GetFileFlag], String) ByteString Source #

Creates an Unfold with which one can stream data out of the entry at the given path (e.g., "foo.txt", "foo/", or "foo/bar.txt").

unfoldFileAtIndex :: MonadIO m => Unfold m (Zip, [GetFileFlag], Int) ByteString Source #

Creates an Unfold with which one can stream data out of the entry at the given index. Please use getNumEntries to find the upper bound for the index.