Skip to content

Commit 2b4815b

Browse files
committed
stream: remove unused & undocumented cb
destroy(err, cb) was an undocumented API which was previously used internally by core modules. However, this is no longer the case and it should be possible to safely remove this. Refs: nodejs#32808
1 parent 9534458 commit 2b4815b

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

lib/internal/streams/destroy.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
'use strict';
22

3-
// Undocumented cb() API, needed for core, not for public API.
4-
// The cb() will be invoked synchronously if _destroy is synchronous.
5-
// If cb is passed no 'error' event will be emitted.
6-
function destroy(err, cb) {
3+
function destroy(err) {
74
const r = this._readableState;
85
const w = this._writableState;
96

107
if ((w && w.destroyed) || (r && r.destroyed)) {
11-
if (typeof cb === 'function') {
12-
// TODO(ronag): Invoke with `'close'`/`'error'`.
13-
cb();
14-
}
15-
168
return this;
179
}
1810

@@ -52,10 +44,6 @@ function destroy(err, cb) {
5244
r.closed = true;
5345
}
5446

55-
if (typeof cb === 'function') {
56-
cb(err);
57-
}
58-
5947
if (err) {
6048
process.nextTick(emitErrorCloseNT, this, err);
6149
} else {

0 commit comments

Comments
 (0)