rethinkdb-stream-chunker
Chunk RethinkDB protocol stream into query or response buffers
Installation
npm i --save rethinkdb-stream-chunker
Examples
QueryStreamChunker
Streams piped throught as QueryStreamChunker will be "chunked" in to query buffers.
This enables functionality that require inspection of incoming queries as a whole, such as query validation
var QueryStreamChunker = QueryStreamChunkervar r = var queryStream = ...var reql = r// create a query buffervar token = 8var len = 4var term = JSONlenterm = termvar queryBuf = Buffer // pipe queryStream to chunkerqueryStream var partialChunks = queryBuf queryBuf queryBuf queryBuf // to end partialChunks
ResponseStreamChunker
Streams piped throught as QueryStreamChunker will be "chunked" in to response buffers.
This enables functionality that require inspection of incoming queries as a whole, such as query validation.
ResponseStreamChunker allows for easy injection of custom responses (such as responding w/ an error when a custom validation of a query fails).
var ResponseStreamChunker = ResponseStreamChunkervar r = var responseChunker = r
License
MIT