bl icon indicating copy to clipboard operation
bl copied to clipboard

Add option to not implicitly end when there is nothing to read()

Open kanongil opened this issue 8 years ago • 0 comments

I have a use case, where I create a BufferList that is piped to a processor.

I want to be able to setup the bl.pipe(processor) before I even start to feed data into the bufferlist. When I try that, the bufferlist immediately ends.

Failing example:

const Stream = require('stream');
const BufferList = require('bl');

const bl = new BufferList();
const processor = new BufferList((err, buffer) => {    // Can be any writable

    console.log('result:', buffer.toString());
});

bl.pipe(processor);

setImmediate(() => {

    bl.append('hello');
    bl.end();
});

kanongil avatar Sep 27 '17 12:09 kanongil