That's extremely fragile advice. Just use an atomic move/rename. i.e. copy it to <name>.tmp and then move it to <name> when done. Don't read any files with suffix .tmp (or use dot files, even better, though if things break crappy sysadmins might not "see" the files).
Matt. On Tue, Feb 28, 2012 at 2:46 PM, Naouak <[email protected]> wrote: > So the best way would be to check whether the file is still growing to > start the process. > I will do that. > > Thanks for the answer. > > Naouak, Grade 2 de Kobal. > Site web: http://www.naouak.net > > > On Tue, Feb 28, 2012 at 20:39, fent <[email protected]> wrote: > >> If you don't know the file size, you could use node-growing-file >> https://github.com/felixge/node-growing-file >> >> It uses a timeout to determine if a file is finished growing or not. >> >> >> On Tuesday, February 28, 2012 12:11:29 PM UTC-7, Naouak wrote: >>> >>> Hi, >>> >>> My aim is to do an automatic operation on files dropped into a directory >>> over the network. >>> >>> To be sure that no one try to modify that file during the execution of >>> the operation, I want to move it from the drop area to another dir. With >>> fs.watch I'm able to tell when a new file arrives with the rename event. >>> The problem is when the transfer is not fast enough, I will get the event >>> before the file has finished transfer. >>> >>> So my question is : Is there a way to know if transfer is done before >>> doing anything ? >>> >>> Thanks for your answers, >>> >>> Naouak, Grade 2 de Kobal. >>> Site web: http://www.naouak.net >>> >> -- >> 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
