var fs = require('fs');
var writeStream = fs.createWriteStream(__dirname + "/uploading.txt");
writeStream.on('open', function(){
console.log('Write stream has open');
//Write a number every 1 second.
var i = 1;
var repeat = function(){
writeStream.write(i);
console.log('Number ' + i + ' has been write to the file');
i = i + 1;
setTimeout(repeat, 1000);
};
repeat();
var readStream = fs.ReadStream(__dirname + "/uploading.txt");
readStream.on('data', function(data){
console.log('Data is coming: ' + data);
});
readStream.on('end', function(){
console.log('Stream END');
});
});
Write stream has open
Number 1 has been write to the file
Data is coming: 1
Stream END
Number 2 has been write to the file
Number 3 has been write to the file
Number 4 has been write to the file
Not sure if it's feasible.. :)
---
Diogo R.
> --
> Job Board: http://jobs.nodejs.org/ [1]
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> [2]
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en [3]
>
>
> Links:
> ------
> [1] http://jobs.nodejs.org/
> [2]
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> [3] http://groups.google.com/group/nodejs?hl=en?hl=en
For more options, visit this group at
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
Yeah.. I was thinking about tail.. :) just 2 "questions".
- Does Windows have any tail-like tool ?
- Are binary files a problem to tail in any way?
---
Diogo R.
- Are binary files a problem to tail in any way?
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
--
Using fs.watchFile() and fs.read() will force me to re-implement stream.pipe(response) again. Using fs.createReadStream(path, {start:offset}) is much more easier.
--
--