Go to file
2024-05-10 15:05:14 -05:00
bun fix: init 2024-05-09 17:21:15 -05:00
src feat: Pipes.Node.FS, Pipes.Node.Buffer, etc. 2024-05-10 15:04:18 -05:00
test/Test feat: Pipes.Node.FS, Pipes.Node.Buffer, etc. 2024-05-10 15:04:18 -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.0.1 2024-05-10 15:04:30 -05:00
README.md docs: update readme 2024-05-09 17:33:44 -05:00
spago.lock fix: lockfile 2024-05-10 15:05:14 -05:00
spago.yaml chore: prepare v1.0.1 2024-05-10 15:04:30 -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