Created
October 7, 2013 17:41
-
-
Save paulbjensen/6871896 to your computer and use it in GitHub Desktop.
A script to replicate an issue with stream writing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| // Dependencies | |
| // | |
| var fs = require('fs'), | |
| oldFilePath = 'oldFile.txt', | |
| read = fs.createReadStream(oldFilePath), | |
| write = fs.createWriteStream('./.newFile.txt'); | |
| // Generate the oldFile first with some example content | |
| // | |
| fs.writeFile(oldFilePath, 'Example Content to write here\n', function (err) { | |
| if (err) { | |
| throw err; | |
| } else { | |
| // Write the file out | |
| // | |
| read.pipe(write); | |
| } | |
| }); |
Author
Thanks. I copied that and ran it on my machine, it didn't work. I'm running v0.10.20 on Mac OS X 10.8.5.
Author
Ignore me. I was using ls -ll to list files, rather than ls -la.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this works..