node/test/parallel/test-stream2-readable-wrap-destroy.js
Matteo Collina f8b9831338 stream: do not use _stream_* anymore
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>
2021-01-05 19:02:04 +01:00

28 lines
485 B
JavaScript

'use strict';
const common = require('../common');
const { Readable } = require('stream');
const EE = require('events').EventEmitter;
const oldStream = new EE();
oldStream.pause = () => {};
oldStream.resume = () => {};
{
new Readable({
autoDestroy: false,
destroy: common.mustCall()
})
.wrap(oldStream);
oldStream.emit('destroy');
}
{
new Readable({
autoDestroy: false,
destroy: common.mustCall()
})
.wrap(oldStream);
oldStream.emit('close');
}