mhkeller / indian-ocean

A library for reading in and writing out data (plus some useful filesystem functions) in Node.js.
https://mhkeller.github.io/indian-ocean/
MIT License
63 stars 14 forks source link

Add notify option to write functions #92

Open mhkeller opened 4 years ago

mhkeller commented 4 years ago

Whenever I use a write function, I also write a notifier since it's nice to be able to see a script's output in the console.

I pretty much always use this three-line pattern:

const outPath = path.join(outDir, `file.csv`);
io.writeDataSync(outPath, data, { makeDirs: true });
notify({ m: 'Wrote...', v: outPath, d: 'green' });

I use the wsk-notify package. It would be useful to have a { notify: true } option in write functions and perhaps notifyOptions that would get passed to the notify function.