uniform-fileio-0.1.5.1: Uniform file handling operations
Safe HaskellSafe-Inferred
LanguageHaskell2010

Uniform.TypedFile

Synopsis

Documentation

class FileHandles a => TypedFiles7a a b where Source #

Methods

read7 :: Path Abs Dir -> Path Rel File -> TypedFile5 a b -> ErrIO b Source #

the 7 have two arguments for path and file

write7 :: Path Abs Dir -> Path Rel File -> TypedFile5 a b -> b -> ErrIO () Source #

read8 :: Path Abs File -> TypedFile5 a b -> ErrIO b Source #

the 8 versions have a single argument for path and file

write8 :: Path Abs File -> TypedFile5 a b -> b -> ErrIO () Source #

renameToBak8 :: Path Abs File -> TypedFile5 a b -> ErrIO () Source #

the createDir if missingis implied in the write

class FileHandles a => TypedFiles7 a b where Source #

the a is the base type which is written on file, b is the type for input and output

Methods

wrap7 :: a -> b Source #

unwrap7 :: b -> a Source #

class FileHandles a => TypedFiles5 a b where Source #

reads or writes a structured file with the specified parsers or writer the first parameter is the type of file, it is the type of the input data and the returned data the second an arbitrary differentiation to allow two file types with different extension and read the b can be () if no differentiation is desired

Minimal complete definition

Nothing

Methods

write5 :: Path Abs Dir -> Path Rel File -> TypedFile5 a b -> a -> ErrIO () Source #

append5 :: Path Abs Dir -> Path Rel File -> TypedFile5 a b -> a -> ErrIO () Source #

read5 :: Path Abs Dir -> Path Rel File -> TypedFile5 a b -> ErrIO a Source #

write6 :: Path Abs File -> TypedFile5 a b -> a -> ErrIO () Source #

openHandle6 :: Path Abs File -> TypedFile5 a b -> ErrIO Handle Source #

writeHandle6 :: Handle -> TypedFile5 a b -> a -> ErrIO () Source #

create the file and open the handle should attache ".tmp" to extension and when closing rename to correct filename - > transaction completed

closeHandle6 :: Path Abs File -> TypedFile5 a b -> Handle -> ErrIO () Source #

append6 :: Path Abs File -> TypedFile5 a b -> a -> ErrIO () Source #

close the handle - with transaction

read6 :: Path Abs File -> TypedFile5 a b -> ErrIO a Source #

exist6 :: Path Abs File -> TypedFile5 a b -> ErrIO Bool Source #

check whether file exist

modificationTime6 :: Path Abs File -> TypedFile5 a b -> ErrIO EpochTime Source #

isTyped :: Path Abs File -> TypedFile5 a b -> Bool Source #

check if a given file is of the right type (extenions, not mime type)

typedExtension :: TypedFile5 a b -> Extension Source #

get the extension back

makeTyped :: Extension -> TypedFile5 a b Source #

Instances

Instances details
TypedFiles5 Text b Source # 
Instance details

Defined in Uniform.TypedFile

TypedFiles5 LazyByteString GZip Source #

files with full triples stored as zip

Instance details

Defined in Uniform.TypedFile

TypedFiles5 [Text] b Source # 
Instance details

Defined in Uniform.TypedFile

data TypedFile5 a b Source #

Constructors

TypedFile5 

Fields

compress :: ByteString -> ByteString #

Compress a stream of data into the gzip format.

This uses the default compression parameters. In particular it uses the default compression level which favours a higher compression ratio over compression speed, though it does not use the maximum compression level.

Use compressWith to adjust the compression level or other compression parameters.

decompress :: ByteString -> ByteString #

Decompress a stream of data in the gzip format.

There are a number of errors that can occur. In each case an exception will be thrown. The possible error conditions are:

  • if the stream does not start with a valid gzip header
  • if the compressed stream is corrupted
  • if the compressed stream ends prematurely

Note that the decompression is performed lazily. Errors in the data stream may not be detected until the end of the stream is demanded (since it is only at the end that the final checksum can be checked). If this is important to you, you must make sure to consume the whole decompressed stream before doing any IO action that depends on it.