Skip to content

Commit

Permalink
doc: add fs declarations to stream doc js examples
Browse files Browse the repository at this point in the history
PR-URL: #18804
Reviewed-By: Weijia Wang <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
  • Loading branch information
prog1dev authored and targos committed Mar 24, 2018
1 parent 9c67262 commit ed55386
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ Calling the [`stream.write()`][stream-write] method after calling

```js
// write 'hello, ' and then end with 'world!'
const fs = require('fs');
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
Expand Down Expand Up @@ -858,6 +859,7 @@ The following example pipes all of the data from the `readable` into a file
named `file.txt`:

```js
const fs = require('fs');
const readable = getReadableStreamSomehow();
const writable = fs.createWriteStream('file.txt');
// All the data from readable goes into 'file.txt'
Expand All @@ -869,6 +871,7 @@ The `readable.pipe()` method returns a reference to the *destination* stream
making it possible to set up chains of piped streams:

```js
const fs = require('fs');
const r = fs.createReadStream('file.txt');
const z = zlib.createGzip();
const w = fs.createWriteStream('file.txt.gz');
Expand Down Expand Up @@ -1029,6 +1032,7 @@ If the `destination` is specified, but no pipe is set up for it, then
the method does nothing.

```js
const fs = require('fs');
const readable = getReadableStreamSomehow();
const writable = fs.createWriteStream('file.txt');
// All the data from readable goes into 'file.txt',
Expand Down

0 comments on commit ed55386

Please sign in to comment.