zstd-0.1.3.0: Haskell bindings to the Zstandard compression algorithm

Copyright | (c) 2016-present Facebook Inc. All rights reserved.
License | BSD3
Maintainer | bryano@fb.com
Stability | experimental
Portability | GHC
Safe Haskell | None
Language | Haskell2010

Codec.Compression.Zstd.Streaming

Description

Streaming compression and decompression support for zstd.

Synopsis

- data Result
  - = Produce ByteString (IO Result)
  - | Consume (ByteString -> IO Result)
  - | Error String String
  - | Done ByteString
- compress :: Int -> IO Result
- decompress :: IO Result
- maxCLevel :: Int

# Documentation

data Result Source #

The result of a streaming compression or decompression step.

Constructors

Produce ByteString (IO Result) | A single frame of transformed data, and an action that when executed will yield the next step in the streaming operation. The action is ephemeral; you should discard it as soon as you use it.
Consume (ByteString -> IO Result) | Provide the function with more input for the streaming operation to continue. This function is ephemeral. You should call it exactly once, and discard it immediately after you call it. To signal the end of a stream of data, supply an `empty` input.
Error String String | An error has occurred. If an error occurs, the streaming operation cannot continue.
Done ByteString | The streaming operation has ended. This payload may be empty. If it is not, it must be written out. A non-empty payload consists of a frame epilogue, possibly preceded by any data left over from the final streaming step.

#### Instances

Instances details

Show Result Source # |
Instance details Defined in Codec.Compression.Zstd.Streaming Methods showsPrec :: Int -> Result -> ShowS Source # show :: Result -> String Source # showList :: [Result] -> ShowS Source #

compress Source #

Arguments

:: Int | Compression level. Must be >= 1 and <= `maxCLevel`.
-> IO Result |

Begin a streaming compression operation.

The initial result will be either an `Error` or a `Consume`.

decompress :: IO Result Source #

Begin a streaming decompression operation.

The initial result will be either an `Error` or a `Consume`.

maxCLevel :: Int Source #

The maximum compression level supported by the library.