fshost / node-dir

Recursive asynchronous file and directory operations for Node.js
MIT License
221 stars 44 forks source link

TypeError: Cannot read property 'files' of undefined #53

Open raghuram-periaswamy opened 7 years ago

raghuram-periaswamy commented 7 years ago

dir.files (recursively) throws an error if any one of the directories is empty.

stack trace:

node-dir/lib/paths.js:92
                results.files = results.files.concat(res.files);
blackarctic commented 5 years ago

This is still an issue on the latest version

Version:

Screen Shot 2019-05-29 at 4 42 10 PM

Code:

Screen Shot 2019-05-29 at 4 44 07 PM

Error:

Screen Shot 2019-05-29 at 4 43 02 PM

eggplantzzz commented 5 years ago

I just confirmed that 0.1.17 still has this behavior.

Is this a problem that is likely to be fixed at some point? If not, does anyone else have any solutions or alternate libraries to use?

YakovL commented 1 year ago

What I've found is while dir.files(options.projectPath, { sync: true }) fails for me as described above, dir.files(options.projectPath, (error, files) => { ... }) works fine (although is not very convenient as it doesn't even return a promise, so one has to make their way around. It's a pity that such a popular library has such an annoying and long-standing bug.