Question: I currently have a basic website/web-server setup through Node.JS (source available at [github](http://github.com/dave911d/dashy)). I have a rethinkDB database running and that's all configured correctly.My main problem is figuring out how to write the output of terminal to RethinkDB. I figured the best way would be to `echo` the terminal output through a Cron job to a file. The main problem is how would I be able to load this file repetitively into the RethinkDB database to then display on the website?

Answer: 
If you have one document per line on stdin, you can just pipe `process.stdin` to a transform stream that would call `JSON.parse` and then you can pipe it to a table using rethinkdbdash.
In Node, you can very easily be notified of file changes through a callback. It is part of the Filesystem module and the function is [fs.watchFile(filename[, options], listener)](https://nodejs.org/api/fs.html#fs_fs_watchfile_filename_options_listener)

Using that, you could maybe watch for changes and update the database as new data gets written.

```
fs.watchFile('message.text', function (curr, prev) {
  // Update db here
});

```