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

Safe Haskell | Safe-Inferred
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
  }
- type PaxHeader = Map ByteString ByteString
- data PaxState = PaxState PaxHeader PaxHeader
- initialPaxState :: PaxState
- 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 #

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 # |
Instance details Defined in Data.Conduit.Tar.Types Methods showsPrec :: Int -> Header -> ShowS # show :: Header -> String # showList :: [Header] -> ShowS #

type PaxHeader = Map ByteString ByteString #

Type synonym representing a pax extended header.

data PaxState #

Type representing states (global, next file) given pax extended headers.

Constructors

PaxState PaxHeader PaxHeader |

initialPaxState :: PaxState #

The initial state before applying any pax extended headers.

data TarChunk #

Constructors

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

#### Instances

Instances details

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

data TarException #

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

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

data TarCreateException #

Constructors

FileNameTooLong !FileInfo |
TarCreationError !String |

#### Instances

Instances details

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

data FileType #

Constructors

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

#### Instances

Instances details

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

data FileInfo #

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

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

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

Bits CUid |

Instance details

Defined in GHC.Internal.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 GHC.Internal.System.Posix.Types Methods finiteBitSize :: CUid -> Int # countLeadingZeros :: CUid -> Int # countTrailingZeros :: CUid -> Int #
Bounded CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods minBound :: CUid # maxBound :: CUid #
Enum CUid |
Instance details Defined in GHC.Internal.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] #
Storable CUid |
Instance details Defined in GHC.Internal.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 () #
Ix CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods range :: (CUid, CUid) -> [CUid] # index :: (CUid, CUid) -> CUid -> Int # unsafeIndex :: (CUid, CUid) -> CUid -> Int # inRange :: (CUid, CUid) -> CUid -> Bool # rangeSize :: (CUid, CUid) -> Int # unsafeRangeSize :: (CUid, CUid) -> Int #
Num CUid |
Instance details Defined in GHC.Internal.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 #
Read CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods readsPrec :: Int -> ReadS CUid # readList :: ReadS [CUid] # readPrec :: ReadPrec CUid # readListPrec :: ReadPrec [CUid] #
Integral CUid |
Instance details Defined in GHC.Internal.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 #
Real CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods toRational :: CUid -> Rational #
Show CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods showsPrec :: Int -> CUid -> ShowS # show :: CUid -> String # showList :: [CUid] -> ShowS #
Eq CUid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods (==) :: CUid -> CUid -> Bool # (/=) :: CUid -> CUid -> Bool #
Ord CUid |
Instance details Defined in GHC.Internal.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 #

newtype CGid #

Constructors

CGid Word32 |

#### Instances

Instances details

Bits CGid |

Instance details

Defined in GHC.Internal.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 GHC.Internal.System.Posix.Types Methods finiteBitSize :: CGid -> Int # countLeadingZeros :: CGid -> Int # countTrailingZeros :: CGid -> Int #
Bounded CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods minBound :: CGid # maxBound :: CGid #
Enum CGid |
Instance details Defined in GHC.Internal.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] #
Storable CGid |
Instance details Defined in GHC.Internal.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 () #
Ix CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods range :: (CGid, CGid) -> [CGid] # index :: (CGid, CGid) -> CGid -> Int # unsafeIndex :: (CGid, CGid) -> CGid -> Int # inRange :: (CGid, CGid) -> CGid -> Bool # rangeSize :: (CGid, CGid) -> Int # unsafeRangeSize :: (CGid, CGid) -> Int #
Num CGid |
Instance details Defined in GHC.Internal.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 #
Read CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods readsPrec :: Int -> ReadS CGid # readList :: ReadS [CGid] # readPrec :: ReadPrec CGid # readListPrec :: ReadPrec [CGid] #
Integral CGid |
Instance details Defined in GHC.Internal.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 #
Real CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods toRational :: CGid -> Rational #
Show CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods showsPrec :: Int -> CGid -> ShowS # show :: CGid -> String # showList :: [CGid] -> ShowS #
Eq CGid |
Instance details Defined in GHC.Internal.System.Posix.Types Methods (==) :: CGid -> CGid -> Bool # (/=) :: CGid -> CGid -> Bool #
Ord CGid |
Instance details Defined in GHC.Internal.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 #

encodeFilePath :: FilePath -> ByteString #

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

decodeFilePath :: ByteString -> FilePath #

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

getFileInfoPath :: FileInfo -> FilePath #

Get the `FilePath`.