Browse Source

docs: fix streams example for write() after end()

Currently there's an example using http.ServerResponse stream, which
has a known bug and will not throw an error while writing after end().
Changed to a writable stream from fs which behaves as expected.

fix #8814

Signed-off-by: Julien Gilli <julien.gilli@joyent.com>
v0.10.34-release
Alejandro Oviedo 10 years ago
committed by Julien Gilli
parent
commit
f5cb330ab1
  1. 9
      doc/api/stream.markdown

9
doc/api/stream.markdown

@ -521,11 +521,10 @@ Calling [`write()`][] after calling [`end()`][] will raise an error.
```javascript
// write 'hello, ' and then end with 'world!'
http.createServer(function (req, res) {
res.write('hello, ');
res.end('world!');
// writing more now is not allowed!
});
var file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// writing more now is not allowed!
```
#### Event: 'finish'

Loading…
Cancel
Save