Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/c-cube/poc-modular-io
proof of concept for https://github.com/ocaml/RFCs/pull/19
https://github.com/c-cube/poc-modular-io
byte-stream io ocaml
Last synced: 3 months ago
JSON representation
proof of concept for https://github.com/ocaml/RFCs/pull/19
- Host: GitHub
- URL: https://github.com/c-cube/poc-modular-io
- Owner: c-cube
- Created: 2020-07-25T18:20:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T04:03:16.000Z (over 1 year ago)
- Last Synced: 2024-04-20T00:54:17.543Z (9 months ago)
- Topics: byte-stream, io, ocaml
- Language: OCaml
- Homepage:
- Size: 39.1 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# poc-modular-io
[![build](https://github.com/c-cube/poc-modular-io/actions/workflows/main.yml/badge.svg)](https://github.com/c-cube/poc-modular-io/actions/workflows/main.yml)
proof of concept for https://github.com/ocaml/RFCs/pull/19
## Examples
The `multicat.sh` tool is like `cat`, but provides options to encode/decode various things.
```sh
$ echo "hello\nworld\n🤗" > foo$ ./multicat.sh foo foo foo -rot13
uryyb\ajbeyq\a🤗
uryyb\ajbeyq\a🤗
uryyb\ajbeyq\a🤗$ ./multicat.sh foo foo foo -rot13 > bar # save it into a file
$ ./multicat.sh bar -rot13 -rot13 -rot13 # triple decode!
hello\nworld\n🤗
hello\nworld\n🤗
hello\nworld\n🤗
```The following example reads a file, translates it via "rot13", then uses
the http1.1 chunked encoding; then the rest of the pipeline decodes the
chunked encoding and rot13.Note that the pipeline runs in constant memory, it does
not need to read the whole file to do its translations.```sh
$ cat src/IO_helpers.ml
… # some content$ ./multicat.sh src/IO_helpers.ml -rot13 -chunk
… # content, but less readable$ ./multicat.sh src/IO_helpers.ml -rot13 -chunk | ./multicat.sh -unchunk -rot13
… # initial content of the file```
## Bugs
`-zip` and `-unzip` don't work yet, I haven't updated them.