unpack package:tar

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.
Like unpack, but run custom sanity/security checks instead of checkEntrySecurity. For example,
import Control.Exception (SomeException(..))
import Control.Applicative ((<|>))

unpackAndCheck (\x -> SomeException <$> checkEntryPortability x
<|> SomeException <$> checkEntrySecurity x) dir entries