summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorGrant Carthew <grant@carthew.net>2018-11-06 08:40:22 +1000
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2018-11-10 14:00:17 +0200
commit85f7af77eeae1a3b15a1958102450c4fc9e06df8 (patch)
tree29d0ff3ae109b8462ac77f64d1947e1cf055a92e /doc
parent71a4cb7d460abb50ef6816917dfc290c4312f00f (diff)
downloadandroid-node-v8-85f7af77eeae1a3b15a1958102450c4fc9e06df8.tar.gz
android-node-v8-85f7af77eeae1a3b15a1958102450c4fc9e06df8.tar.bz2
android-node-v8-85f7af77eeae1a3b15a1958102450c4fc9e06df8.zip
doc: fix code examples in stream.md
* Replace `console.error()` with `console.log()`. * Fix case and punctuation in logged output. PR-URL: https://github.com/nodejs/node/pull/24112 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/stream.md26
1 files changed, 13 insertions, 13 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 2f35ec30b5..8d31719109 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -291,7 +291,7 @@ for (let i = 0; i < 100; i++) {
}
writer.end('This is the end\n');
writer.on('finish', () => {
- console.error('All writes are now complete.');
+ console.log('All writes are now complete.');
});
```
@@ -309,7 +309,7 @@ a readable stream, adding this writable to its set of destinations.
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
writer.on('pipe', (src) => {
- console.error('something is piping into the writer');
+ console.log('Something is piping into the writer.');
assert.equal(src, reader);
});
reader.pipe(writer);
@@ -334,7 +334,7 @@ This is also emitted in case this [`Writable`][] stream emits an error when a
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
writer.on('unpipe', (src) => {
- console.error('Something has stopped piping into the writer.');
+ console.log('Something has stopped piping into the writer.');
assert.equal(src, reader);
});
reader.pipe(writer);
@@ -551,7 +551,7 @@ function write(data, cb) {
// Wait for cb to be called before doing any other write.
write('hello', () => {
- console.log('write completed, do more writes now');
+ console.log('Write completed, do more writes now.');
});
```
@@ -1091,7 +1091,7 @@ const readable = getReadableStreamSomehow();
readable.setEncoding('utf8');
readable.on('data', (chunk) => {
assert.equal(typeof chunk, 'string');
- console.log('got %d characters of string data', chunk.length);
+ console.log('Got %d characters of string data:', chunk.length);
});
```
@@ -1119,9 +1119,9 @@ const writable = fs.createWriteStream('file.txt');
// but only for the first second
readable.pipe(writable);
setTimeout(() => {
- console.log('Stop writing to file.txt');
+ console.log('Stop writing to file.txt.');
readable.unpipe(writable);
- console.log('Manually close the file stream');
+ console.log('Manually close the file stream.');
writable.end();
}, 1000);
```
@@ -1338,9 +1338,9 @@ const rs = fs.createReadStream('archive.tar');
finished(rs, (err) => {
if (err) {
- console.error('Stream failed', err);
+ console.error('Stream failed.', err);
} else {
- console.log('Stream is done reading');
+ console.log('Stream is done reading.');
}
});
@@ -1360,7 +1360,7 @@ const rs = fs.createReadStream('archive.tar');
async function run() {
await finished(rs);
- console.log('Stream is done reading');
+ console.log('Stream is done reading.');
}
run().catch(console.error);
@@ -1395,9 +1395,9 @@ pipeline(
fs.createWriteStream('archive.tar.gz'),
(err) => {
if (err) {
- console.error('Pipeline failed', err);
+ console.error('Pipeline failed.', err);
} else {
- console.log('Pipeline succeeded');
+ console.log('Pipeline succeeded.');
}
}
);
@@ -1414,7 +1414,7 @@ async function run() {
zlib.createGzip(),
fs.createWriteStream('archive.tar.gz')
);
- console.log('Pipeline succeeded');
+ console.log('Pipeline succeeded.');
}
run().catch(console.error);