Note that there are some explanatory texts on larger screens.

plurals
  1. PONodeJS fs.open failing on existing file (not a path issue)
    text
    copied!<p>I've been dealing with this for a long time, so any help is much appreciated. So, I'm downloading a file and saving it using PhantomJS and CasperJS. Let me point out that they aren't the issue. The file is downloaded without a problem.</p> <p>The problem is that NodeJS won't recognize or open the file after it is downloaded. I can't fs.stat, fs.open, etc.. Nothing works.</p> <p>I'll share the code in a second, but here's the log:</p> <pre><code>Here: bdTcK6hSdownload.csv [ '2puzZMeLdownload.csv', '2s5ICbKNdownload.csv', 'bdTcK6hSdownload.csv', 'izIfagwCdownload.csv' ] fs.js:230 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); Error: ENOENT, no such file or directory './caspertemp/bdTcK6hSdownload.csv' at Object.openSync (fs.js:230:18) at Object.processCSV (/Users/Home/dev/node_modules/inviter/index.js:64:29) at /Users/Home/dev/node_modules/inviter/index.js:36:33 at ChildProcess.exithandler (child_process.js:281:7) at ChildProcess.emit (events.js:70:17) at maybeExit (child_process.js:361:16) at Process.onexit (child_process.js:397:5) </code></pre> <p>As you can see, I'm printing out the created file name, then printing the contents of the directory and then trying to open the file. As you can see, bdTcK6hSdownload.csv exists in the directory but fails on open.</p> <p>The simple code snippet is here:</p> <pre><code>console.log('Here: ' + filename); filenames = fs.readdirSync('./caspertemp/'); console.log(filenames); var fd = fs.openSync('./caspertemp/' + filename, 'r'); console.log(fd); </code></pre> <p>There's a bunch more going on before and after this but none of it matters since this basic function fails. Please help! This has been nagging for weeks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload