Go to file
2024-05-11 22:11:40 -05:00
bun fix: init 2024-05-09 17:21:15 -05:00
src fix: generalize all Affs to MonadAffs 2024-05-11 22:08:27 -05:00
test/Test fix: more Pipes.Collect utils, stack-safety 2024-05-11 18:01:43 -05:00
.gitignore fix: init 2024-05-09 17:21:15 -05:00
.tool-versions fix: init 2024-05-09 17:21:15 -05:00
bun.lockb fix: init 2024-05-09 17:21:15 -05:00
jsconfig.json fix: init 2024-05-09 17:21:15 -05:00
package.json chore: prepare v1.2.2 2024-05-11 22:10:57 -05:00
README.md docs: update readme 2024-05-09 17:33:44 -05:00
spago.lock chore: lock 2024-05-11 22:11:40 -05:00
spago.yaml chore: prepare v1.2.2 2024-05-11 22:10:57 -05:00

purescript-node-stream-pipes

Interact with node streams in object mode using Pipes!

Example

import Prelude

import Effect.Aff (launchAff_)
import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Pipes.Prelude ((>->))
import Pipes.Prelude as Pipes
import Pipes.Core as Pipes.Core
import Pipes.Node.FS.Stream as FS
import Pipes.Node.Zlib as Zlib
import Pipes.CSV.Parse as CSV.Parse

-- == my-zipped-data.csv ==
-- id,foo,is_deleted
-- 1,hello,f
-- 2,goodbye,t

-- Logs:
-- {id: 1, foo: "hello", is_deleted: false}
-- {id: 2, foo: "goodbye", is_deleted: true}
main :: Effect Unit
main =
  Pipes.Core.runEffect
    $ FS.createReadStream "my-zipped-data.csv.gz"
        >-> Zlib.gunzip
        >-> CSV.Parse.parse @{id :: Int, foo :: String, is_deleted :: Boolean}
        >-> Pipes.mapM (liftEffect <<< log)

Installing

spago install node-stream-pipes