Go to file
2024-05-14 13:42:39 -05:00
bun fix: init 2024-05-09 17:21:15 -05:00
src fix: catch incorrect stream implementations 2024-05-14 13:42:39 -05:00
test/Test feat: Pipes.Construct 2024-05-13 11:21:06 -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.4.0 2024-05-14 13:12:56 -05:00
README.md docs: update readme 2024-05-09 17:33:44 -05:00
spago.lock wip: explore removing delays(9) 2024-05-14 12:43:38 -05:00
spago.yaml chore: prepare v1.4.0 2024-05-14 13:12:56 -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