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

Streamly.External.Zip.Internal

Synopsis

Documentation

newtype Zip Source #

A zip archive.

Constructors

Zip (ForeignPtr Zip_t) 

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.

getNumEntries :: Zip -> IO Int Source #

Gets the number of entries in the given archive.

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.

data File Source #

A file inside of a Zip archive.

Internal.

Constructors

File !(Ptr Zip_file_t) !IOFinalizer 

data GetFileFlag Source #

Constructors

GF_FL_COMPRESSED

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

getFileByPathOrIndex :: Zip -> [GetFileFlag] -> Either String Int -> IO File Source #

We don't publicly expose getting a File (and then unfolding from it) because we don't want users to unfold from the same File more than once. (libzip’s c_zip_fread isn’t designed for iterating through a file more than once.)

Internal.

combineFlags :: (Ord flagType, Bits a, Num a) => Map flagType a -> [flagType] -> a Source #

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.