简体   繁体   中英

File Exists But Receiving ENOENT Error

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

I have two scenarios. One works and one fails even though the code is exactly the same.

  1. Take a CSV file already on the box and parse it. Works perfectly. No issues.
  2. Take a CSV file that was just created and attempt to parse it and I receive:

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

Same CSV file format and all that. Wouldn't matter anyway because the created file won't even open. It fails with the error above even though the file does exist. If I restart Node and attempt to grab that file, then it works perfectly. If I run fs.stat on the newly created file it fails.

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

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

Thanks!

System:

OSX Lion Node v0.6.7

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

I took a look on the gist and I guess you are downloading the file from somewhere and then parsing it. Without the whole code I can only guess, but I think that you started the download, but you haven't received a clear indication it is there and ready to be parsed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM