Copyright | (c) Christian Gram Kalhauge 2019 |
---|---|
License | MIT |
Maintainer | kalhauge@cs.ucla.edu |
Safe Haskell | None |
Language | Haskell2010 |
Enables reading and writeing zipfiles using dirtrees. It is not a complete 1-1 mapping but for many usecases it gets the job done.
It is based of the `zip-archive` library, which can be used if more control is needed.
Synopsis
- entriesToDirForest :: [Entry] -> Maybe (RelativeDirForest Link ByteString)
- entriesFromDirForest :: Integer -> RelativeDirForest Link ByteString -> [Entry]
- entryToDirForest :: Entry -> Maybe (DirForest Entry)
- entryFromFile :: Integer -> FileKey -> RelativeFile Link ByteString -> Entry
- files :: Lens' Archive (RelativeDirForest Link ByteString)
- entries :: Lens' Archive [Entry]
- toArchive :: ByteString -> Archive
- fromArchive :: Archive -> ByteString
Documentation
entriesToDirForest :: [Entry] -> Maybe (RelativeDirForest Link ByteString) Source #
Convert entries to a FileMap
of RelativeDirTree
entriesFromDirForest :: Integer -> RelativeDirForest Link ByteString -> [Entry] Source #
Create a list of enties from a FileMap.
Helpers
entryToDirForest :: Entry -> Maybe (DirForest Entry) Source #
Convert a entry to a single filemap, fails if the entry path is empty.
entryFromFile :: Integer -> FileKey -> RelativeFile Link ByteString -> Entry Source #
Create a single entry from a file. This also handles symlinks, but changes
saves all files with the stdFileMode
.
files :: Lens' Archive (RelativeDirForest Link ByteString) Source #
A lens to get and set the files of an archive. Uses sparingly on big archvies as it will convert forth and back.
Re-Exports
toArchive :: ByteString -> Archive #
Reads an Archive
structure from a raw zip archive (in a lazy bytestring).
fromArchive :: Archive -> ByteString #
Writes an Archive
structure to a raw zip archive (in a lazy bytestring).