Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ Readable.prototype.removeListener = function(ev, fn) {

return res;
};
Readable.prototype.off = Readable.prototype.removeListener;

Readable.prototype.removeAllListeners = function(ev) {
const res = Stream.prototype.removeAllListeners.apply(this, arguments);
Expand Down
2 changes: 2 additions & 0 deletions test/parallel/test-stream-readable-readable-then-resume.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const common = require('../common');
const { Readable } = require('stream');
const assert = require('assert');

// This test verifies that a stream could be resumed after
// removing the readable event in the same tick
Expand All @@ -24,6 +25,7 @@ function check(s) {
const readableListener = common.mustNotCall();
s.on('readable', readableListener);
s.on('end', common.mustCall());
assert.strictEqual(s.removeListener, s.off);
s.removeListener('readable', readableListener);
s.resume();
}