diff options
author | Kyle K <kylek389@gmail.com> | 2018-06-08 19:24:11 +0000 |
---|---|---|
committer | Kyle K <kylek389@gmail.com> | 2018-06-08 19:24:11 +0000 |
commit | 4d719ba0bc7f482c43bffde4309a12bf741527c2 (patch) | |
tree | acb6bc92e244f4595014399b9f766242003ee724 | |
parent | bcd40d9580bfd1c08708b265e09d05f38659237e (diff) | |
download | jsexamples-4d719ba0bc7f482c43bffde4309a12bf741527c2.tar.gz jsexamples-4d719ba0bc7f482c43bffde4309a12bf741527c2.tar.bz2 jsexamples-4d719ba0bc7f482c43bffde4309a12bf741527c2.zip |
js Streams example
-rw-r--r-- | streams.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/streams.js b/streams.js new file mode 100644 index 0000000..74049e3 --- /dev/null +++ b/streams.js @@ -0,0 +1,11 @@ +var fs = require('fs'); +var readableStream = fs.createReadStream('/home/kyle//hello.c'); +var fileData = ''; + +readableStream.on('data', function(chunk) { + fileData += chunk; +}); + +readableStream.on('end', function() { + console.log(fileData); +}); |