Fs.readdir Is Not Working When I Try To Read A Folder
Solution 1:
I am answering my own question, in case it helps some others like me, who are moving from frontend coding to understanding node.js.
It's difficult to grasp that some modules are just not meant for browsers and fs
is one them and when you try to use 'require' that's another roadblock.. so if, like me, you are here because you tried to use fs
in your javascript linked to your html to read something from your local machine or server and expected it to show up on the browser, it won't work.
It's a bit frustrating but once you get your head around it, it makes sense. So although this might not be the answer you looked for, I thought I'd just share this so that you don't waste more time, trying to make it work.
Getting to understand node.js and how to use fs
on node.js would be better use of time..:-)..
Post a Comment for "Fs.readdir Is Not Working When I Try To Read A Folder"