TheSpyder / rescript-nodejs

Node bindings for ReScript
MIT License
79 stars 15 forks source link
nodejs rescript

rescript-nodejs

Node.js bindings for ReScript

npm

Requirements

Works on ReScript 10 or above. Supports uncurried mode in ReScript 11.

Installation

npm install rescript-nodejs

or

yarn add rescript-nodejs

Then add rescript-nodejs to bsconfig.json:

  "bs-dependencies": [
    "rescript-nodejs"
  ],

Goal of this library

Help all ReScript Node.js apps and libraries to be built faster by reducing the time spent on hand written bindings.

Non-Goals

Principles

Stream a file into stdout:

open NodeJs

Fs.createReadStream("/path")
  ->Stream.pipe(Process.stdout(Process.process))
  ->Stream.onError(_ => Js.log("handleError"))

Echo server:

open NodeJs

Http.createServer((request, response) => {
  request->Stream.onData(data => Js.log(data))
  request->Stream.pipe(response)->ignore
});

Contributing

We welcome and encourage anyone to contribute! In order to minimize confusion and avoid any wasted effort, here are some recommendations:

License and Credits

All code is licensed as MIT. See LICENSE.

This project was forked from reason-nodejs after it was (or appeared to be) abandoned. If the original authors would like to re-engage please email me.