Skip to content

Commit cdc67e8

Browse files
anonrigtpoisseau
authored andcommitted
zlib: remove zlib.bytesRead
Use `zlib.bytesWritten` instead. PR-URL: nodejs#55020 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 5cc83d3 commit cdc67e8

File tree

4 files changed

+4
-141
lines changed

4 files changed

+4
-141
lines changed

doc/api/deprecations.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2290,6 +2290,9 @@ core and obsoleted by the removal of NPN (Next Protocol Negotiation) support.
22902290

22912291
<!-- YAML
22922292
changes:
2293+
- version: REPLACEME
2294+
pr-url: https://github.com/nodejs/node/pull/55020
2295+
description: End-of-Life.
22932296
- version: v11.0.0
22942297
pr-url: https://github.com/nodejs/node/pull/23308
22952298
description: Runtime deprecation.
@@ -2298,7 +2301,7 @@ changes:
22982301
description: Documentation-only deprecation.
22992302
-->
23002303

2301-
Type: Runtime
2304+
Type: End-of-Life
23022305

23032306
Deprecated alias for [`zlib.bytesWritten`][]. This original name was chosen
23042307
because it also made sense to interpret the value as the number of bytes

doc/api/zlib.md

-17
Original file line numberDiff line numberDiff line change
@@ -684,22 +684,6 @@ base class of the compressor/decompressor classes.
684684
This class inherits from [`stream.Transform`][], allowing `node:zlib` objects to
685685
be used in pipes and similar stream operations.
686686

687-
### `zlib.bytesRead`
688-
689-
<!-- YAML
690-
added: v8.1.0
691-
deprecated: v10.0.0
692-
-->
693-
694-
> Stability: 0 - Deprecated: Use [`zlib.bytesWritten`][] instead.
695-
696-
* {number}
697-
698-
Deprecated alias for [`zlib.bytesWritten`][]. This original name was chosen
699-
because it also made sense to interpret the value as the number of bytes
700-
read by the engine, but is inconsistent with other streams in Node.js that
701-
expose values under these names.
702-
703687
### `zlib.bytesWritten`
704688

705689
<!-- YAML
@@ -1307,7 +1291,6 @@ Decompress a chunk of data with [`Unzip`][].
13071291
[`buffer.kMaxLength`]: buffer.md#bufferkmaxlength
13081292
[`deflateInit2` and `inflateInit2`]: https://zlib.net/manual.html#Advanced
13091293
[`stream.Transform`]: stream.md#class-streamtransform
1310-
[`zlib.bytesWritten`]: #zlibbyteswritten
13111294
[convenience methods]: #convenience-methods
13121295
[zlib documentation]: https://zlib.net/manual.html#Constants
13131296
[zlib.createGzip example]: #zlib

lib/zlib.js

-21
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ const {
4646
genericNodeError,
4747
} = require('internal/errors');
4848
const { Transform, finished } = require('stream');
49-
const {
50-
deprecate,
51-
} = require('internal/util');
5249
const {
5350
isArrayBufferView,
5451
isAnyArrayBuffer,
@@ -271,24 +268,6 @@ ObjectDefineProperty(ZlibBase.prototype, '_closed', {
271268
},
272269
});
273270

274-
// `bytesRead` made sense as a name when looking from the zlib engine's
275-
// perspective, but it is inconsistent with all other streams exposed by Node.js
276-
// that have this concept, where it stands for the number of bytes read
277-
// *from* the stream (that is, net.Socket/tls.Socket & file system streams).
278-
ObjectDefineProperty(ZlibBase.prototype, 'bytesRead', {
279-
__proto__: null,
280-
configurable: true,
281-
enumerable: true,
282-
get: deprecate(function() {
283-
return this.bytesWritten;
284-
}, 'zlib.bytesRead is deprecated and will change its meaning in the ' +
285-
'future. Use zlib.bytesWritten instead.', 'DEP0108'),
286-
set: deprecate(function(value) {
287-
this.bytesWritten = value;
288-
}, 'Setting zlib.bytesRead is deprecated. ' +
289-
'This feature will be removed in the future.', 'DEP0108'),
290-
});
291-
292271
/**
293272
* @this ZlibBase
294273
* @returns {void}

test/parallel/test-zlib-bytes-read.js

-102
This file was deleted.

0 commit comments

Comments
 (0)