I have a stream of events that are captured via HTTPS calls to an external API gateway.
Multiple threads may publish events, multiple threads may consume events and store them in couchbase as a buffer.
An event embodies a single line of CSV.
Every xx minutes, I need to combine these events into one file by appending them line by line, and then upload that file to an external server. Then delete the events from couchbase.

How could this be achieved using couchbase server and Node.JS client library?