Shin, I commented on your gist with code you can use. You just need to
modify it to catchup with existing data. Please treat this only as a proof
of concept, and be aware you need to handle error unexpected errors like
truncated files, deleted files, and so on. Also keep in mind that on OS X
fs.watchFile() is still kind of slow, on Linux you will get much faster
results.

On Mon, Feb 6, 2012 at 1:39 AM, Shin Suzuki <[email protected]> wrote:

> Marcel,
>
> I wrote a simple code with 12 lines to read newly added lines of a file
> when changes happen, as you do in the previous sample.
>
> https://gist.github.com/1750489
>
> However, it couldn't read newly added data (Node v0.6.9, macOS X).
>
> Is something wrong with my code?
> How can your code work without re-opening the file?
>
>
>
> 2012/2/3 Mi Jun <[email protected]>
>
>> 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.
>>
>> --
>> 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 [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>  --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to