node-dir
node-dir copied to clipboard
TypeError: Cannot read property 'files' of undefined
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);
This is still an issue on the latest version
Version:
Code:
Error:
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?
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.