| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e1951a4 commit 9f95d41
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -565,7 +565,7 @@ function writeOrBuffer(stream, state, chunk, encoding, callback) { | |||
| 565 | 565 | state[kState] &= ~kSync; | |
| 566 | 566 | } | |
| 567 | 567 | ||
| 568 | - const ret = state.length < state.highWaterMark; | ||
| 568 | + const ret = state.length < state.highWaterMark || state.length === 0; | ||
| 569 | 569 | ||
| 570 | 570 | if (!ret) { | |
| 571 | 571 | state[kState] |= kNeedDrain; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -85,3 +85,27 @@ const { inspect } = require('util'); | |||
| 85 | 85 | hwm, | |
| 86 | 86 | })); | |
| 87 | 87 | } | |
| 88 | + | ||
| 89 | + { | ||
| 90 | + const res = []; | ||
| 91 | + const r = new stream.Readable({ | ||
| 92 | + read() {}, | ||
| 93 | + }); | ||
| 94 | + const w = new stream.Writable({ | ||
| 95 | + highWaterMark: 0, | ||
| 96 | + write(chunk, encoding, callback) { | ||
| 97 | + res.push(chunk.toString()); | ||
| 98 | + callback(); | ||
| 99 | + }, | ||
| 100 | + }); | ||
| 101 | + | ||
| 102 | + r.pipe(w); | ||
| 103 | + r.push('a'); | ||
| 104 | + r.push('b'); | ||
| 105 | + r.push('c'); | ||
| 106 | + r.push(null); | ||
| 107 | + | ||
| 108 | + r.on('end', common.mustCall(() => { | ||
| 109 | + assert.deepStrictEqual(res, ['a', 'b', 'c']); | ||
| 110 | + })); | ||
| 111 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments