• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const { Readable, Writable } = require('stream');
5
6// https://github.com/nodejs/node/issues/48666
7(async () => {
8  // Prepare src that is internally ended, with buffered data pending
9  const src = new Readable({ read() {} });
10  src.push(Buffer.alloc(100));
11  src.push(null);
12  src.pause();
13
14  // Give it time to settle
15  await new Promise((resolve) => setImmediate(resolve));
16
17  const dst = new Writable({
18    highWaterMark: 1000,
19    write(buf, enc, cb) {
20      process.nextTick(cb);
21    }
22  });
23
24  dst.write(Buffer.alloc(1000)); // Fill write buffer
25  dst.on('finish', common.mustCall());
26  src.pipe(dst);
27})().then(common.mustCall());
28