diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown index 3230a59276c..e0f7d72bab8 100644 --- a/doc/api/stream.markdown +++ b/doc/api/stream.markdown @@ -517,14 +517,20 @@ function writeOneMillionTimes(writer, data, encoding, callback) { Call this method when no more data will be written to the stream. If supplied, the callback is attached as a listener on the `finish` event. -Calling [`write()`][] after calling [`end()`][] will raise an error. - ```javascript // write 'hello, ' and then end with 'world!' var file = fs.createWriteStream('example.txt'); file.write('hello, '); file.end('world!'); -// writing more now is not allowed! +``` + +Calling [`write()`][] after calling [`end()`][] will raise an error: + +```javascript +// end with 'world!' and then write with 'hello, ' will raise an error +var file = fs.createWriteStream('example.txt'); +file.end('world!'); +file.write('hello, '); ``` #### Event: 'finish'