Browse Source

doc: Fix readable.unshift() example

Slice the portion of the buffer to unshift back into the read queue
v0.9.12-release
Evan Oxfeld 12 years ago
committed by isaacs
parent
commit
16ddc545bd
  1. 1
      doc/api/stream.markdown

1
doc/api/stream.markdown

@ -264,6 +264,7 @@ SimpleProtocol.prototype._read = function(n) {
}
// now, because we got some extra data, unshift the rest
// back into the read queue so that our consumer will see it.
var b = chunk.slice(split);
this.unshift(b);
// and let them know that we are done parsing the header.

Loading…
Cancel
Save