Copyright | (c) 2007 Bjorn Bringert 2008 Andrea Vezzosi 2008-2009 2012 2016 Duncan Coutts |
---|---|
License | BSD3 |
Maintainer | duncan@community.haskell.org |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Codec.Archive.Tar.Unpack
Description
Documentation
Create local files and directories based on the entries of a tar archive.
This is a portable implementation of unpacking suitable for portable
archives. It handles NormalFile
and Directory
entries and has simulated
support for SymbolicLink
and HardLink
entries. Links are implemented by
copying the target file. This therefore works on Windows as well as Unix.
All other entry types are ignored, that is they are not unpacked and no
exception is raised.
If the Entries
ends in an error then it is raised an an exception. Any
files or directories that have been unpacked before the error was
encountered will not be deleted. For this reason you may want to unpack
into an empty directory so that you can easily clean up if unpacking fails
part-way.
On its own, this function only checks for security (using checkEntrySecurity
).
Use unpackAndCheck
if you need more checks.
Arguments
:: Exception e | |
=> (GenEntry FilePath FilePath -> Maybe SomeException) | Checks to run on each entry before unpacking |
-> FilePath | Base directory |
-> Entries e | Entries to upack |
-> IO () |
Like unpack
, but run custom sanity/security checks instead of checkEntrySecurity
.
For example,
unpackAndCheck (\x -> SomeException <$> checkEntryPortability x <|> SomeException <$> checkEntrySecurity x) dir entries
Since: 0.6.0.0