duplex-combination

Combine a readable and writable stream into a duplex stream

BSD 6 个版本
安装
npm install duplex-combination
yarn add duplex-combination
pnpm add duplex-combination
bun add duplex-combination
README

duplex-combination

Merge a readable and writable stream together into a duplex stream

USE

var dp = new DuplexCombination(reader, writer, options);

dp.write("data");
dp.on('readable', function() {
    dp.read(n);
})

Additional public properties

The read and write streams are exposed with the properties dp.reader and dp.writer

ERRORS

Error events include the stream that triggered the error, so you can:

dp.on('error',function(err,stream) {
    if (stream === dp.reader) {
        // error while reading
    }
    else {
        // error while writing
    }
});

Acknowledgements

Stolen shamelessly from Isaac Schuleter's duplex-passthrough module.

版本列表
1.2.1 2015-06-25
1.2.0 2014-08-17
1.1.1 2014-07-28
1.1.0 2014-07-28
1.0.1 2014-06-06
1.0.0 2014-02-03