fs-api-0.3.0.0: Abstract interface for the file system
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.FS.API.Lazy

Synopsis

API

Lazy functions

hGetAll :: Monad m => HasFS m h -> Handle h -> m ByteString Source #

Read all the data from the given file handle 64kB at a time.

Stops when EOF is reached.

hGetAllAt Source #

Arguments

:: Monad m 
=> HasFS m h 
-> Handle h 
-> AbsOffset

The offset at which to read.

-> m ByteString 

Like hGetAll, but is thread safe since it does not change or depend on the file offset. pread syscall is used internally.

hGetExactly :: forall m h. (HasCallStack, MonadThrow m) => HasFS m h -> Handle h -> Word64 -> m ByteString Source #

Makes sure it reads all requested bytes. If eof is found before all bytes are read, it throws an exception.

hGetExactlyAt Source #

Arguments

:: forall m h. (HasCallStack, MonadThrow m) 
=> HasFS m h 
-> Handle h 
-> Word64

The number of bytes to read.

-> AbsOffset

The offset at which to read.

-> m ByteString 

Like hGetExactly, but is thread safe since it does not change or depend on the file offset. pread syscall is used internally.

hPut :: forall m h. (HasCallStack, Monad m) => HasFS m h -> Handle h -> Builder -> m Word64 Source #

This function makes sure that the whole Builder is written.

The chunk size of the resulting ByteString determines how much memory will be used while writing to the handle.

hPutAll :: forall m h. (HasCallStack, Monad m) => HasFS m h -> Handle h -> ByteString -> m Word64 Source #

This function makes sure that the whole ByteString is written.