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 https://github.com/joyent/node/issues/8814.
PR-URL: https://github.com/iojs/io.js/pull/155
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Brendan Ashworth <squirrelslikeacorns@gmail.com>
```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'