Search code examples
node.jsstreamrethinkdbpiping

How to pipe a node stream into a RethinkDB table


Is there any convenient way to pipe a NodeJS stream into a RethinkDB table?

I'm thinking something similar to this for PostgreSQL:

pg.connect(function(err, client, done) {
  var stream = client.query(copyFrom('COPY my_table FROM STDIN'));
  var fileStream = fs.createReadStream('some_file.csv')
  fileStream.pipe(stream).on('finish', done);
});

Imagine you have large amounts of data and want to pipe it to a RethinkDB database using streams, what's the best way to do it?

Thanks!


Solution

  • You might want to check out the third-party driver RethinkDB Dash which has writeable streams. The official driver doesn't implement the stream interface currently, but we may be doing it in the near future