Skip to content

Commit

Permalink
doc: change write() after end() streams example
Browse files Browse the repository at this point in the history
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.

Fixes nodejs/node-v0.x-archive#8814.

PR-URL: nodejs#155
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
  • Loading branch information
a0viedo authored and bnoordhuis committed Dec 14, 2014
1 parent db595b2 commit 524882f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions doc/api/stream.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,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'
Expand Down

0 comments on commit 524882f

Please sign in to comment.