From 524882faca28955aa5ef2a6194aab3895b0498b6 Mon Sep 17 00:00:00 2001 From: Alejandro Oviedo Date: Fri, 12 Dec 2014 13:03:13 -0300 Subject: [PATCH] doc: change write() after end() streams example 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 Reviewed-By: Brendan Ashworth --- doc/api/stream.markdown | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index 5ffcef91456a59..d1fa2cca350e04 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -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'