tar-conduit-0.3.2: Extract and create tar files using conduit for streaming

Safe Haskell | Safe
Language | Haskell2010

Data.Conduit.Tar.Types

Description

Module contains all the types necessary for tarball processing.

Synopsis

- data Header = Header {
  - headerOffset :: !FileOffset
  - headerPayloadOffset :: !FileOffset
  - headerFileNameSuffix :: !ShortByteString
  - headerFileMode :: !CMode
  - headerOwnerId :: !UserID
  - headerGroupId :: !GroupID
  - headerPayloadSize :: !FileOffset
  - headerTime :: !EpochTime
  - headerLinkIndicator :: !Word8
  - headerLinkName :: !ShortByteString
  - headerMagicVersion :: !ShortByteString
  - headerOwnerName :: !ShortByteString
  - headerGroupName :: !ShortByteString
  - headerDeviceMajor :: !DeviceID
  - headerDeviceMinor :: !DeviceID
  - headerFileNamePrefix :: !ShortByteString
  }
- data TarChunk
  - = ChunkHeader Header
  - | ChunkPayload !FileOffset !ByteString
  - | ChunkException TarException
- data TarException
  - = NoMoreHeaders
  - | UnexpectedPayload !FileOffset
  - | IncompleteHeader !FileOffset
  - | IncompletePayload !FileOffset !ByteCount
  - | ShortTrailer !FileOffset
  - | BadTrailer !FileOffset
  - | InvalidHeader !FileOffset
  - | BadChecksum !FileOffset
  - | FileTypeError !FileOffset !Char !String
  - | UnsupportedType !FileType
- data TarCreateException
  - = FileNameTooLong !FileInfo
  - | TarCreationError !String
- data FileType
  - = FTNormal
  - | FTHardLink !ByteString
  - | FTSymbolicLink !ByteString
  - | FTCharacterSpecial
  - | FTBlockSpecial
  - | FTDirectory
  - | FTFifo
  - | FTOther !Word8
- data FileInfo = FileInfo {
  - filePath :: !ByteString
  - fileUserId :: !UserID
  - fileUserName :: !ByteString
  - fileGroupId :: !GroupID
  - fileGroupName :: !ByteString
  - fileMode :: !FileMode
  - fileSize :: !FileOffset
  - fileType :: !FileType
  - fileModTime :: !EpochTime
  }
- type FileOffset = COff
- type ByteCount = CSize
- type UserID = CUid
- type GroupID = CGid
- type DeviceID = CDev
- type EpochTime = CTime
- newtype CUid = CUid Word32
- newtype CGid = CGid Word32
- encodeFilePath :: FilePath -> ByteString
- decodeFilePath :: ByteString -> FilePath
- getFileInfoPath :: FileInfo -> FilePath

# Documentation

data Header Source #

Constructors

Header |

Fields

- headerOffset :: !FileOffset
- headerPayloadOffset :: !FileOffset
- headerFileNameSuffix :: !ShortByteString
- headerFileMode :: !CMode
- headerOwnerId :: !UserID
- headerGroupId :: !GroupID
- headerPayloadSize :: !FileOffset
- headerTime :: !EpochTime
- headerLinkIndicator :: !Word8
- headerLinkName :: !ShortByteString
- headerMagicVersion :: !ShortByteString
- headerOwnerName :: !ShortByteString
- headerGroupName :: !ShortByteString
- headerDeviceMajor :: !DeviceID
- headerDeviceMinor :: !DeviceID
- headerFileNamePrefix :: !ShortByteString

#### Instances

Instances details

Show Header Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> Header -> ShowS show :: Header -> String showList :: [Header] -> ShowS

data TarChunk Source #

Constructors

ChunkHeader Header |
ChunkPayload !FileOffset !ByteString |
ChunkException TarException |

#### Instances

Instances details

Show TarChunk Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarChunk -> ShowS show :: TarChunk -> String showList :: [TarChunk] -> ShowS

data TarException Source #

This the the exception type that is used in this module.

More constructors are susceptible to be added without bumping the major version of this module.

Constructors

NoMoreHeaders |
UnexpectedPayload !FileOffset |
IncompleteHeader !FileOffset |
IncompletePayload !FileOffset !ByteCount |
ShortTrailer !FileOffset |
BadTrailer !FileOffset |
InvalidHeader !FileOffset |
BadChecksum !FileOffset |
FileTypeError !FileOffset !Char !String |
UnsupportedType !FileType |

#### Instances

Instances details

Show TarException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarException -> ShowS show :: TarException -> String showList :: [TarException] -> ShowS
Exception TarException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods toException :: TarException -> SomeException # fromException :: SomeException -> Maybe TarException # displayException :: TarException -> String #

data TarCreateException Source #

Constructors

FileNameTooLong !FileInfo |
TarCreationError !String |

#### Instances

Instances details

Show TarCreateException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> TarCreateException -> ShowS show :: TarCreateException -> String showList :: [TarCreateException] -> ShowS
Exception TarCreateException Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods toException :: TarCreateException -> SomeException # fromException :: SomeException -> Maybe TarCreateException # displayException :: TarCreateException -> String #

data FileType Source #

Constructors

FTNormal |
FTHardLink !ByteString |
FTSymbolicLink !ByteString |
FTCharacterSpecial |
FTBlockSpecial |
FTDirectory |
FTFifo |
FTOther !Word8 |

#### Instances

Instances details

Eq FileType Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods (==) :: FileType -> FileType -> Bool (/=) :: FileType -> FileType -> Bool
Show FileType Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> FileType -> ShowS show :: FileType -> String showList :: [FileType] -> ShowS

data FileInfo Source #

Constructors

FileInfo |

Fields

- filePath :: !ByteString

  File path.

- fileUserId :: !UserID

  Unix user id.

- fileUserName :: !ByteString

  Unix user name.

- fileGroupId :: !GroupID

  Unix group id.

- fileGroupName :: !ByteString

  Unix group name.

- fileMode :: !FileMode

  Unix file permissions

- fileSize :: !FileOffset

  File size

- fileType :: !FileType

  File type. `FTNormal`, `FTHardLink` (@since 0.3.0), `FTSymbolicLink` and `FTDirectory` are the only ones supported for now

- fileModTime :: !EpochTime

  File modification timestamp

#### Instances

Instances details

Eq FileInfo Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods (==) :: FileInfo -> FileInfo -> Bool (/=) :: FileInfo -> FileInfo -> Bool
Show FileInfo Source # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> FileInfo -> ShowS show :: FileInfo -> String showList :: [FileInfo] -> ShowS

type FileOffset = COff #

type ByteCount = CSize #

type UserID = CUid #

type GroupID = CGid #

type DeviceID = CDev #

type EpochTime = CTime #

newtype CUid #

Constructors

CUid Word32 |

#### Instances

Instances details

Bounded CUid |
Instance details Defined in System.Posix.Types Methods minBound :: CUid maxBound :: CUid
Enum CUid |
Instance details Defined in System.Posix.Types Methods succ :: CUid -> CUid pred :: CUid -> CUid toEnum :: Int -> CUid fromEnum :: CUid -> Int enumFrom :: CUid -> [CUid] enumFromThen :: CUid -> CUid -> [CUid] enumFromTo :: CUid -> CUid -> [CUid] enumFromThenTo :: CUid -> CUid -> CUid -> [CUid]
Eq CUid |
Instance details Defined in System.Posix.Types Methods (==) :: CUid -> CUid -> Bool (/=) :: CUid -> CUid -> Bool
Integral CUid |
Instance details Defined in System.Posix.Types Methods quot :: CUid -> CUid -> CUid rem :: CUid -> CUid -> CUid div :: CUid -> CUid -> CUid mod :: CUid -> CUid -> CUid quotRem :: CUid -> CUid -> (CUid, CUid) divMod :: CUid -> CUid -> (CUid, CUid) toInteger :: CUid -> Integer
Num CUid |
Instance details Defined in System.Posix.Types Methods (+) :: CUid -> CUid -> CUid (-) :: CUid -> CUid -> CUid (*) :: CUid -> CUid -> CUid negate :: CUid -> CUid abs :: CUid -> CUid signum :: CUid -> CUid fromInteger :: Integer -> CUid
Ord CUid |
Instance details Defined in System.Posix.Types Methods compare :: CUid -> CUid -> Ordering (<) :: CUid -> CUid -> Bool (<=) :: CUid -> CUid -> Bool (>) :: CUid -> CUid -> Bool (>=) :: CUid -> CUid -> Bool max :: CUid -> CUid -> CUid min :: CUid -> CUid -> CUid
Read CUid |
Instance details Defined in System.Posix.Types Methods readsPrec :: Int -> ReadS CUid readList :: ReadS [CUid] readPrec :: ReadPrec CUid readListPrec :: ReadPrec [CUid]
Real CUid |
Instance details Defined in System.Posix.Types Methods toRational :: CUid -> Rational
Show CUid |
Instance details Defined in System.Posix.Types Methods showsPrec :: Int -> CUid -> ShowS show :: CUid -> String showList :: [CUid] -> ShowS
Bits CUid |

Instance details

Defined in System.Posix.Types

Methods

(.&.) :: CUid -> CUid -> CUid

(.|.) :: CUid -> CUid -> CUid

xor :: CUid -> CUid -> CUid

complement :: CUid -> CUid

shift :: CUid -> Int -> CUid

rotate :: CUid -> Int -> CUid

zeroBits :: CUid

bit :: Int -> CUid

setBit :: CUid -> Int -> CUid

clearBit :: CUid -> Int -> CUid

complementBit :: CUid -> Int -> CUid

testBit :: CUid -> Int -> Bool

bitSizeMaybe :: CUid -> Maybe Int

bitSize :: CUid -> Int

isSigned :: CUid -> Bool

shiftL :: CUid -> Int -> CUid

unsafeShiftL :: CUid -> Int -> CUid

shiftR :: CUid -> Int -> CUid

unsafeShiftR :: CUid -> Int -> CUid

rotateL :: CUid -> Int -> CUid

rotateR :: CUid -> Int -> CUid

popCount :: CUid -> Int

FiniteBits CUid |
Instance details Defined in System.Posix.Types Methods finiteBitSize :: CUid -> Int countLeadingZeros :: CUid -> Int countTrailingZeros :: CUid -> Int
Storable CUid |
Instance details Defined in System.Posix.Types Methods sizeOf :: CUid -> Int alignment :: CUid -> Int peekElemOff :: Ptr CUid -> Int -> IO CUid pokeElemOff :: Ptr CUid -> Int -> CUid -> IO () peekByteOff :: Ptr b -> Int -> IO CUid pokeByteOff :: Ptr b -> Int -> CUid -> IO () peek :: Ptr CUid -> IO CUid poke :: Ptr CUid -> CUid -> IO ()

newtype CGid #

Constructors

CGid Word32 |

#### Instances

Instances details

Bounded CGid |
Instance details Defined in System.Posix.Types Methods minBound :: CGid maxBound :: CGid
Enum CGid |
Instance details Defined in System.Posix.Types Methods succ :: CGid -> CGid pred :: CGid -> CGid toEnum :: Int -> CGid fromEnum :: CGid -> Int enumFrom :: CGid -> [CGid] enumFromThen :: CGid -> CGid -> [CGid] enumFromTo :: CGid -> CGid -> [CGid] enumFromThenTo :: CGid -> CGid -> CGid -> [CGid]
Eq CGid |
Instance details Defined in System.Posix.Types Methods (==) :: CGid -> CGid -> Bool (/=) :: CGid -> CGid -> Bool
Integral CGid |
Instance details Defined in System.Posix.Types Methods quot :: CGid -> CGid -> CGid rem :: CGid -> CGid -> CGid div :: CGid -> CGid -> CGid mod :: CGid -> CGid -> CGid quotRem :: CGid -> CGid -> (CGid, CGid) divMod :: CGid -> CGid -> (CGid, CGid) toInteger :: CGid -> Integer
Num CGid |
Instance details Defined in System.Posix.Types Methods (+) :: CGid -> CGid -> CGid (-) :: CGid -> CGid -> CGid (*) :: CGid -> CGid -> CGid negate :: CGid -> CGid abs :: CGid -> CGid signum :: CGid -> CGid fromInteger :: Integer -> CGid
Ord CGid |
Instance details Defined in System.Posix.Types Methods compare :: CGid -> CGid -> Ordering (<) :: CGid -> CGid -> Bool (<=) :: CGid -> CGid -> Bool (>) :: CGid -> CGid -> Bool (>=) :: CGid -> CGid -> Bool max :: CGid -> CGid -> CGid min :: CGid -> CGid -> CGid
Read CGid |
Instance details Defined in System.Posix.Types Methods readsPrec :: Int -> ReadS CGid readList :: ReadS [CGid] readPrec :: ReadPrec CGid readListPrec :: ReadPrec [CGid]
Real CGid |
Instance details Defined in System.Posix.Types Methods toRational :: CGid -> Rational
Show CGid |
Instance details Defined in System.Posix.Types Methods showsPrec :: Int -> CGid -> ShowS show :: CGid -> String showList :: [CGid] -> ShowS
Bits CGid |

Instance details

Defined in System.Posix.Types

Methods

(.&.) :: CGid -> CGid -> CGid

(.|.) :: CGid -> CGid -> CGid

xor :: CGid -> CGid -> CGid

complement :: CGid -> CGid

shift :: CGid -> Int -> CGid

rotate :: CGid -> Int -> CGid

zeroBits :: CGid

bit :: Int -> CGid

setBit :: CGid -> Int -> CGid

clearBit :: CGid -> Int -> CGid

complementBit :: CGid -> Int -> CGid

testBit :: CGid -> Int -> Bool

bitSizeMaybe :: CGid -> Maybe Int

bitSize :: CGid -> Int

isSigned :: CGid -> Bool

shiftL :: CGid -> Int -> CGid

unsafeShiftL :: CGid -> Int -> CGid

shiftR :: CGid -> Int -> CGid

unsafeShiftR :: CGid -> Int -> CGid

rotateL :: CGid -> Int -> CGid

rotateR :: CGid -> Int -> CGid

popCount :: CGid -> Int

FiniteBits CGid |
Instance details Defined in System.Posix.Types Methods finiteBitSize :: CGid -> Int countLeadingZeros :: CGid -> Int countTrailingZeros :: CGid -> Int
Storable CGid |
Instance details Defined in System.Posix.Types Methods sizeOf :: CGid -> Int alignment :: CGid -> Int peekElemOff :: Ptr CGid -> Int -> IO CGid pokeElemOff :: Ptr CGid -> Int -> CGid -> IO () peekByteOff :: Ptr b -> Int -> IO CGid pokeByteOff :: Ptr b -> Int -> CGid -> IO () peek :: Ptr CGid -> IO CGid poke :: Ptr CGid -> CGid -> IO ()

encodeFilePath :: FilePath -> ByteString Source #

Convert `FilePath` into a UTF-8 encoded `ByteString`

decodeFilePath :: ByteString -> FilePath Source #

Convert UTF-8 encoded `ByteString` back into the `FilePath`.

getFileInfoPath :: FileInfo -> FilePath Source #

Get the `FilePath`.