mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
f8b9831338
Remove all leftover usage of _stream_* and keep all of them as legacy. We do not deprecate the old modules to avoid disrupition and ease maintainance. PR-URL: https://github.com/nodejs/node/pull/36684 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
32 lines
594 B
JavaScript
32 lines
594 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const { Readable, Writable } = require('stream');
|
|
|
|
// Pipe should pause temporarily if writable needs drain.
|
|
{
|
|
const w = new Writable({
|
|
write(buf, encoding, callback) {
|
|
process.nextTick(callback);
|
|
},
|
|
highWaterMark: 1
|
|
});
|
|
|
|
while (w.write('asd'));
|
|
|
|
assert.strictEqual(w.writableNeedDrain, true);
|
|
|
|
const r = new Readable({
|
|
read() {
|
|
this.push('asd');
|
|
this.push(null);
|
|
}
|
|
});
|
|
|
|
r.on('pause', common.mustCall(2));
|
|
r.on('end', common.mustCall());
|
|
|
|
r.pipe(w);
|
|
}
|