purescript-cbor-stream/README.md

29 lines
638 B
Markdown
Raw Normal View History

2024-05-14 20:01:46 +00:00
# purescript-cbor-stream
2024-05-14 16:41:29 +00:00
2024-05-14 20:01:46 +00:00
Type-safe bindings for the streaming API of `cbor-x`
2024-05-14 16:41:29 +00:00
## Installing
```bash
2024-05-14 20:01:46 +00:00
spago install cbor-stream
{bun|yarn|npm|pnpm} install cbor-x
2024-05-14 16:41:29 +00:00
```
2024-05-22 20:50:30 +00:00
## Examples
### Convert a cbor-encoded dataset to csv
```purescript
import Pipes.Node.Stream as Pipes.Stream
import Pipes.Node.FS as Pipes.FS
import Pipes.Node.Buffer as Pipes.Buffer
import Pipes.CBOR as Pipes.CBOR
import Pipes.CSV as Pipes.CSV
import Pipes.Prelude ((>->))
import Pipes.Prelude as Pipes
Pipes.runEffect
$ Pipes.FS.read "foo.bin"
>-> Pipes.CBOR.decode @{id :: Int, name :: String}
>-> Pipes.CSV.stringify
>-> Pipes.FS.write "foo.csv"
```