File exists but getting ENOENT error

Here is the gist: https://gist.github.com/973e70bde8e6a530c489

I have two scenarios. One works, and one fails, although the code is exactly the same.

  • Take the CSV file already in the field and analyze it. Works great. No problems.
  • Take the CSV file that was just created and try to parse it, and I get:

    ENOENT, there is no such file or directory '/Users/Home/dev/csv/TwFrI5vhdownload.csv

Same CSV file format and all that. It does not matter, since the created file does not even open. It does not work with the error above, although the file exists. If I restart Node and try to capture this file, then it works fine. If I run fs.stat in a newly created file, this will not work.

I tried timeouts, external callbacks, etc., but with a dynamically created file, it always fails.

What am I missing here? Is the file locked and I don’t know it?

Thank!

System:

OSX Lion Node v0.6.7

+5
source share
1 answer

Are you sure the file is actually created when you try to parse it?

I took a look at the gist, and I think you download the file somewhere and then parse it. Without all the code, I can only guess, but I think you started the download, but you did not get a clear indication that it is there and is ready for analysis.

0
source

All Articles