Skip to content

Commit

Permalink
Revert "stream: add bytesRead property for readable"
Browse files Browse the repository at this point in the history
This reverts commit bfb2cd0.

Refs: nodejs#4372
  • Loading branch information
cjihrig committed Jan 18, 2016
1 parent ff64a4c commit b630502
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 127 deletions.
5 changes: 0 additions & 5 deletions doc/api/stream.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,6 @@ readable: null
end
```


#### readable.bytesRead

The amount of read bytes. If `objectMode` is `true`, the value is 0 always.

#### readable.isPaused()

* Return: `Boolean`
Expand Down
3 changes: 0 additions & 3 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ function Readable(options) {

this._readableState = new ReadableState(options, this);

this.bytesRead = 0;

// legacy
this.readable = true;

Expand Down Expand Up @@ -137,7 +135,6 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
var e = new Error('stream.unshift() after end event');
stream.emit('error', e);
} else {
stream.bytesRead += state.objectMode ? 0 : chunk.length;
if (state.decoder && !addToFront && !encoding)
chunk = state.decoder.write(chunk);

Expand Down
5 changes: 5 additions & 0 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ exports._normalizeConnectArgs = normalizeConnectArgs;
// called when creating new Socket, or when re-using a closed Socket
function initSocketHandle(self) {
self.destroyed = false;
self.bytesRead = 0;
self._bytesDispatched = 0;
self._sockname = null;

Expand Down Expand Up @@ -514,6 +515,10 @@ function onread(nread, buffer) {
// will prevent this from being called again until _read() gets
// called again.

// if it's not enough data, we'll just call handle.readStart()
// again right away.
self.bytesRead += nread;

// Optimization: emit the original buffer with end points
var ret = self.push(buffer);

Expand Down
119 changes: 0 additions & 119 deletions test/parallel/test-stream2-readable-bytesread.js

This file was deleted.

0 comments on commit b630502

Please sign in to comment.