Compare commits
3 Commits
v0.1.0
...
22b6942900
| Author | SHA1 | Date | |
|---|---|---|---|
| 22b6942900 | |||
| c1e9fb7b8e | |||
| 82085eaaf9 |
@@ -16,3 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
## Executive Summary
|
## Executive Summary
|
||||||
This library allows for reading and writing to and from CSV files in a streaming manner. Files can be read and written to on a row-by-row basis allowing larger files to be worked with, since the whole file doesn't have to be loaded to manipulate it. It is based on the [conduit](https://hackage.haskell.org/package/conduit] library.
|
This library allows for reading and writing to and from CSV files in a streaming manner. Files can be read and written to on a row-by-row basis allowing larger files to be worked with, since the whole file doesn't have to be loaded to manipulate it. It is based on the [conduit](https://hackage.haskell.org/package/conduit] library.
|
||||||
|
|
||||||
|
## Pull Requests
|
||||||
|
Please make pull requests to the `dev` branch.
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ encodeCSV
|
|||||||
:: Monad m
|
:: Monad m
|
||||||
=> [[T.Text]]
|
=> [[T.Text]]
|
||||||
-- ^ the data being encoded, organized into rows and fields
|
-- ^ the data being encoded, organized into rows and fields
|
||||||
-> ConduitT () BS.ByteString m ()
|
-> ConduitT o BS.ByteString m ()
|
||||||
encodeCSV csv = sourceList csv .| encodeRows
|
encodeCSV csv = sourceList csv .| encodeRows
|
||||||
|
|
||||||
-- | encode an entire CSV file
|
-- | encode an entire CSV file
|
||||||
@@ -161,7 +161,7 @@ encodeRawCSV
|
|||||||
:: Monad m
|
:: Monad m
|
||||||
=> [[BS.ByteString]]
|
=> [[BS.ByteString]]
|
||||||
-- ^ the data being encoded, organized into rows and fields
|
-- ^ the data being encoded, organized into rows and fields
|
||||||
-> ConduitT () BS.ByteString m ()
|
-> ConduitT o BS.ByteString m ()
|
||||||
encodeRawCSV csv = sourceList csv .| encodeRawRows
|
encodeRawCSV csv = sourceList csv .| encodeRawRows
|
||||||
|
|
||||||
-- | Writes a stream of Text-based rows to a CSV file
|
-- | Writes a stream of Text-based rows to a CSV file
|
||||||
@@ -217,7 +217,7 @@ decodeUTF8 bs = case decodeUtf8' bs of
|
|||||||
Left _ -> Nothing
|
Left _ -> Nothing
|
||||||
Right txt -> Just txt
|
Right txt -> Just txt
|
||||||
|
|
||||||
-- | convert a stream to ByteStrings to a string of bytes
|
-- | convert a stream to ByteStrings to a stream of bytes
|
||||||
toBytes :: Monad m => ConduitT BS.ByteString Word8 m ()
|
toBytes :: Monad m => ConduitT BS.ByteString Word8 m ()
|
||||||
toBytes = await >>= \case
|
toBytes = await >>= \case
|
||||||
Just bs -> do
|
Just bs -> do
|
||||||
|
|||||||
Reference in New Issue
Block a user