child-reprocess
v0.1.2
Published
ReasonML bindings for Node's child_process modules
Downloads
4
Maintainers
Readme
Child-ReProcess
ReasonML bindings for Node.js child_process module
Installation
npm i child-reprocess
then add it as a dependency to bsconfig.json
{
...
"bs-dependencies": ["child-reprocess"]
}
Design decisions
Module Structure:
- ChildReprocess : the main module
- Util : unrelated utility functions/operators
- StdStream : simple event-focused stream bindings
- Writeable : writeable stream event bindings (stdout, stderr)
- Readable : readable stream event bindings (stdin)
- ChildReprocess : the main module
~option
objects are pure javascript objects (Js.t({..})
)Event handlers are defined as separate functions. Example:
const cp = require("child_process") let process = cp.spawn( "youtube-dl", ["https://www.youtube.com/watch?v=15CXY6JAqbk"] ); process.stdout.on( "data", chunk => console.log(String(chunk)), );
is equivalent to:
open ChildReprocess.Util; /* <.> (functional composition) */ open ChildReprocess.StdStream; /* Readable */ let process = ChildReprocess.spawn( "youtube-dl", [|"https://www.youtube.com/watch?v=15CXY6JAqbk"|], (), ); process ->child_stdout ->Readable.on_data( Js.log <.> Node_buffer.toString );