-
Notifications
You must be signed in to change notification settings - Fork 37
readable event no longer works #37
Comments
readable
event no longer works
To elaborate a bit further, a complete implementation for this module would be:
|
@vitaly-t pg-query-stream's reversion to the classic readable stream style is what's breaking dmfay/massive-js#473 too btw. |
@dmfay you probably meant the other way round? Because it was previously supporting |
no -- modern streams have |
@dmfay @brianc any resolution on this? Would really appreciate a fix on this. I am willing to help and send a PR if you can point me in the right direction. vitaly-t/pg-promise#502 needs this fix. |
You want @brianc, not me :) I wound up writing a wrapper to be able to return a modern stream from Massive. |
Bumped into this. Wrapping the stream like @dmfay suggested works. const stream = require('stream')
module.exports = function toReadable(classicStream) {
const readableStream = new stream.Readable({ objectMode: true })
classicStream.on('data', (data) => {
readableStream.push(data)
})
classicStream.on('end', () => {
readableStream.push(null)
})
readableStream._read = () => {}
return readableStream
} |
Version 1.1.0 broke compatibility where it no longer supports readable event.
The general rule/recommendation for supporting data vs readable is as follows:
data
must be present when the data is provided in chunks (as an array of rows)readable
must be supported when data is provided as one-by-one itemSee this question for more details: https://stackoverflow.com/questions/26174308/what-are-the-differences-between-readable-and-data-event-of-process-stdin-stream
This library provides only data in simplified form one-by-one, which means readable should be supported first of all, and data secondarily.
However, this library stopped supporting readable event since version 1.1.0
The text was updated successfully, but these errors were encountered: