Skip to content
Advertisement

Bufferizing data from stream in nodeJS for perfoming bulk insert

How to bufferize efficiently in nodeJS on events from a stream to bulk insert instead of unique insert per record received from the stream. Here’s pseudo code I’ve got in mind:

JavaScript

Does this look realistic? Is there any possible optimization? Existing libraries facilitaties that?

Advertisement

Answer

I ended up with a no dependency solution.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement