-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | TAR (tape archive format) library. -- -- This is a library for reading and writing TAR archives. @package tar @version 0.1.1 -- | This is a library for reading and writing TAR archives. module Codec.Archive.Tar -- | A TAR archive. newtype TarArchive TarArchive :: [TarEntry] -> TarArchive archiveEntries :: TarArchive -> [TarEntry] -- | A TAR archive entry for a file or directory. data TarEntry TarEntry :: TarHeader -> ByteString -> TarEntry -- | Entry meta-data. entryHeader :: TarEntry -> TarHeader -- | Entry contents. For entries other than normal files, this should be an -- empty string. entryData :: TarEntry -> ByteString -- | TAR archive entry meta-data. data TarHeader TarHeader :: FilePath -> FileMode -> UserID -> GroupID -> Int64 -> EpochTime -> TarFileType -> FilePath -> String -> String -> CMajor -> CMinor -> TarHeader -- | Path of the file or directory. The path separator should be / -- for portable TAR archives. tarFileName :: TarHeader -> FilePath -- | UNIX file mode. tarFileMode :: TarHeader -> FileMode -- | Numeric owner user id. Should be set to 0 if unknown. tarOwnerID :: TarHeader -> UserID -- | Numeric owner group id. Should be set to 0 if unknown. tarGroupID :: TarHeader -> GroupID -- | File size in bytes. Should be 0 for entries other than normal files. tarFileSize :: TarHeader -> Int64 -- | Last modification time, expressed as the number of seconds since the -- UNIX epoch. tarModTime :: TarHeader -> EpochTime -- | Type of this entry. tarFileType :: TarHeader -> TarFileType -- | If the entry is a hard link or a symbolic link, this is the path of -- the link target. For all other entry types this should be "". tarLinkTarget :: TarHeader -> FilePath -- | The owner user name. Should be set to "" if unknown. tarOwnerName :: TarHeader -> String -- | The owner group name. Should be set to "" if unknown. tarGroupName :: TarHeader -> String -- | For character and block device entries, this is the major number of -- the device. For all other entry types, it should be set to 0. tarDeviceMajor :: TarHeader -> CMajor -- | For character and block device entries, this is the minor number of -- the device. For all other entry types, it should be set to 0. tarDeviceMinor :: TarHeader -> CMinor -- | TAR archive entry types. data TarFileType TarNormalFile :: TarFileType TarHardLink :: TarFileType TarSymbolicLink :: TarFileType TarCharacterDevice :: TarFileType TarBlockDevice :: TarFileType TarDirectory :: TarFileType TarFIFO :: TarFileType TarOther :: Char -> TarFileType -- | 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. createTarFile :: FilePath -> [FilePath] -> IO () -- | 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. createTarData :: [FilePath] -> IO ByteString -- | 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. createTarArchive :: [FilePath] -> IO TarArchive -- | Creates a TAR archive entry for a file or directory. The meta-data and -- file contents are taken from the given file. createTarEntry :: FilePath -> IO TarEntry -- | 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. recurseDirectories :: [FilePath] -> IO [FilePath] -- | Writes a TAR archive to a lazy ByteString. -- -- The archive is written in USTAR (POSIX.1-1988) format (tar with -- extended header information). writeTarArchive :: TarArchive -> ByteString -- | Writes a TAR archive to a file. -- -- See writeTarArchive for more information. writeTarFile :: FilePath -> TarArchive -> IO () -- | Reads a TAR archive from a file and extracts its contents into the -- current directory. -- -- See readTarArchive and extractTarArchive for more -- information. extractTarFile :: FilePath -> IO () -- | Reads a TAR archive from a lazy ByteString and extracts its contents -- into the current directory. -- -- See readTarArchive and extractTarArchive for more -- information. extractTarData :: ByteString -> IO () -- | Extracts the contents of a TAR archive into the current directory. -- -- If problems are encountered, warnings are printed to stderr, -- and the extraction continues. extractTarArchive :: TarArchive -> IO () -- | Extracts a TAR entry into the current directory. -- -- This function throws an exception if any problems are encountered. extractTarEntry :: TarEntry -> IO () -- | Reads a TAR archive from a lazy ByteString. readTarArchive :: ByteString -> TarArchive -- | Reads a TAR archive from a file. -- -- See readTarArchive for more information. readTarFile :: FilePath -> IO TarArchive