Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
(fix): handle streams in object mode while buffering (#258)
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshshanmugam committed Sep 10, 2018
1 parent 6f7eb28 commit b3d3b80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/streams/stringifier-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ module.exports = class StringifierStream extends stream.Transform {
// Consume streams in parallel
if (st instanceof stream) {
st.buffer = [];
const onData = data => st.buffer.push(data);
const onData = data => {
data = data instanceof Buffer ? data : Buffer.from(data);
st.buffer.push(data);
};

st.setMaxListeners(st.getMaxListeners() + 1);
st.on('data', onData);
Expand Down
2 changes: 1 addition & 1 deletion tests/streams/stringifier-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('Stringifier Stream', () => {
let streams = [
new PassThrough(),
new PassThrough(),
new PassThrough()
new PassThrough({ objectMode: true })
];
const stream = new StringifierStream(tag => {
if (tag && tag.name) {
Expand Down

0 comments on commit b3d3b80

Please sign in to comment.