From 40a43f35a0b9f09120b894382da709ce0f2c4c00 Mon Sep 17 00:00:00 2001 From: Alejandro Oviedo Date: Fri, 12 Dec 2014 13:03:13 -0300 Subject: [PATCH] docs: changed example in streams 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. fixes https://github.com/joyent/node/issues/8814 --- 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'