This is a library for reading and writing TAR archives.
- newtype TarArchive = TarArchive {
- archiveEntries :: [TarEntry]
- data TarEntry = TarEntry {}
- data TarHeader = TarHeader {}
- data TarFileType
- createTarFile :: FilePath -> [FilePath] -> IO ()
- createTarData :: [FilePath] -> IO ByteString
- createTarArchive :: [FilePath] -> IO TarArchive
- createTarEntry :: FilePath -> IO TarEntry
- recurseDirectories :: [FilePath] -> IO [FilePath]
- writeTarArchive :: TarArchive -> ByteString
- writeTarFile :: FilePath -> TarArchive -> IO ()
- extractTarFile :: FilePath -> IO ()
- extractTarData :: ByteString -> IO ()
- extractTarArchive :: TarArchive -> IO ()
- extractTarEntry :: TarEntry -> IO ()
- readTarArchive :: ByteString -> TarArchive
- readTarFile :: FilePath -> IO TarArchive
TAR archive types
A TAR archive entry for a file or directory.
TarEntry | |
|
TAR archive entry meta-data.
TarHeader | |
|
data TarFileType Source
TAR archive entry types.
Creating TAR archives
:: FilePath | File to write the archive to. |
-> [FilePath] | Files and directories to include in the archive. |
-> IO () |
Creates a TAR archive containing a number of files and directories, and write the archive to a file.
See createTarArchive
and writeTarArchive
for more information.
:: [FilePath] | Files and directories to include in the archive. |
-> IO ByteString |
Creates a TAR archive containing a number of files and directories, and returns the archive as a lazy ByteString.
See createTarArchive
and writeTarArchive
for more information.
:: [FilePath] | Files and directories to include in the archive. |
-> IO TarArchive |
Creates a TAR archive containing a number of files and directories taken from the file system. In the list of paths, any directory should come before any files in that directory. Only files and directories mentioned in the list are included, this function does not recurse into the directories.
createTarEntry :: FilePath -> IO TarEntrySource
Creates a TAR archive entry for a file or directory. The meta-data and file contents are taken from the given file.
recurseDirectories :: [FilePath] -> IO [FilePath]Source
Recurses through a list of files and directories in depth-first order. Each of the given paths are returned, and each path which refers to a directory is followed by its descendants. The output is suitable for feeding to the TAR archive creation functions.
Writing TAR archives
writeTarArchive :: TarArchive -> ByteStringSource
Writes a TAR archive to a lazy ByteString.
The archive is written in USTAR (POSIX.1-1988) format (tar with extended header information).
:: FilePath | The file to write the archive to. |
-> TarArchive | The archive to write out. |
-> IO () |
Writes a TAR archive to a file.
See writeTarArchive
for more information.
Extracting TAR archives
Reads a TAR archive from a file and extracts its contents into the current directory.
See readTarArchive
and extractTarArchive
for more information.
:: ByteString | Data from which the archive is read. |
-> IO () |
Reads a TAR archive from a lazy ByteString and extracts its contents into the current directory.
See readTarArchive
and extractTarArchive
for more information.
extractTarArchive :: TarArchive -> IO ()Source
Extracts the contents of a TAR archive into the current directory.
If problems are encountered, warnings are printed to
stderr
, and the extraction continues.
extractTarEntry :: TarEntry -> IO ()Source
Extracts a TAR entry into the current directory.
This function throws an exception if any problems are encountered.
Reading TAR archives
readTarArchive :: ByteString -> TarArchiveSource
Reads a TAR archive from a lazy ByteString.
:: FilePath | File to read the archive from. |
-> IO TarArchive |
Reads a TAR archive from a file.
See readTarArchive
for more information.