Popularity
3.1
Growing
Activity
0.0
Stable
4
2
0

Monthly Downloads: 4
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Streaming     Streamly    

streamly-cassava alternatives and similar packages

Based on the "streamly" category.
Alternatively, view streamly-cassava alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of streamly-cassava or a related project?

Add another 'streamly' Package

README

streamly-cassava

Stream CSV data in\/out using Cassava. Adapted from streaming-cassava.

For efficiency, operates on streams of strict ByteString chunks (i.e. IsStream t => t m ByteString) rather than directly on streams of Word8. The chunkStream function is useful for generating an input stream from a handle.

Example usage:

import Streamly
import qualified Streamly.Prelude as S
import Streamly.Csv (decode, encode, chunkStream)
import System.IO
import qualified Data.Csv as Csv
import qualified Data.ByteString as BS
import Data.Vector (Vector)

main = do
  h <- openFile "testfile.csv" ReadMode
  let chunks = chunkStream h (64*1024)
      recs = decode Csv.HasHeader chunks :: SerialT IO (Vector BS.ByteString)
  withFile "dest.csv" WriteMode $ \ho ->
    S.mapM_ (BS.hPut ho) $ encode Nothing recs