Skip to content

Commit

Permalink
zlib: set zlib.bytesRead end-of-life
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Sep 19, 2024
1 parent 291d90a commit 34c1d02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2284,6 +2284,9 @@ core and obsoleted by the removal of NPN (Next Protocol Negotiation) support.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/55020
description: End-of-Life.
- version: v11.0.0
pr-url: https://github.com/nodejs/node/pull/23308
description: Runtime deprecation.
Expand All @@ -2292,7 +2295,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Runtime
Type: End-of-Life

Deprecated alias for [`zlib.bytesWritten`][]. This original name was chosen
because it also made sense to interpret the value as the number of bytes
Expand Down
21 changes: 0 additions & 21 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ const {
genericNodeError,
} = require('internal/errors');
const { Transform, finished } = require('stream');
const {
deprecate,
} = require('internal/util');
const {
isArrayBufferView,
isAnyArrayBuffer,
Expand Down Expand Up @@ -272,24 +269,6 @@ ObjectDefineProperty(ZlibBase.prototype, '_closed', {
},
});

// `bytesRead` made sense as a name when looking from the zlib engine's
// perspective, but it is inconsistent with all other streams exposed by Node.js
// that have this concept, where it stands for the number of bytes read
// *from* the stream (that is, net.Socket/tls.Socket & file system streams).
ObjectDefineProperty(ZlibBase.prototype, 'bytesRead', {
__proto__: null,
configurable: true,
enumerable: true,
get: deprecate(function() {
return this.bytesWritten;
}, 'zlib.bytesRead is deprecated and will change its meaning in the ' +
'future. Use zlib.bytesWritten instead.', 'DEP0108'),
set: deprecate(function(value) {
this.bytesWritten = value;
}, 'Setting zlib.bytesRead is deprecated. ' +
'This feature will be removed in the future.', 'DEP0108'),
});

/**
* @this ZlibBase
* @returns {void}
Expand Down

0 comments on commit 34c1d02

Please sign in to comment.