1.0.0 • Published 4 years ago

easedrop v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

easedrop

easedrop allows you to easily monitor Writable and/or Duplex instances from the stream module. It does this by calling a callback function when data is written.

setup

setting up easedrop is easy, all you have to do is use npm to install the module

npm i easedrop

then you just require it as per normal

const easedrop = require("easedrop");

start

to start monitoring a Writable or Duplex, just call the easedrop.start function. you'll need to pass in the Writable or Duplex instance you will be monitoring, and a callback that is called whenever there is a write. here's what that would look like

// create a callback function
function exampleCallback(string) {
    console.log("monitored: " + string);
}

// call start and provide the instance and callback
easedrop.start(process.stderr, exampleCallback);

the callback will now be called every time that process.stderr.write - in this example - is called.

stop

you may want to stop receiving callbacks at some point, this is easily done by using the easedrop.stop function. this function only takes in the Writable or Duplex instance that you want to stop monitoring. here's how this would look

// call stop and provide the instance
easedrop.stop(process.stderr);

now you will stop receiving callbacks when process.stderr.write - in this example - is called.

licence

MIT

1.0.0

4 years ago