Still saying fs.readdir is not a function
- Dominant language
- JavaScript
- Stars
- 556
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
I'm fairly new to these modules and NPMs but I've been getting along okay until now, this module seems like it's exactly what I need to fix my TypeError: fs.readdir is not a function. The problem is brfs isn't doing anything and the description/examples are not helping me at all.
How the hell am I supposed to use this module?
The only other thing I can say is that I did install brfs, it is in my dependencies alongside browserify, and the command I use in terminal to output my project is "browserify -t brfs main.js > bundle.js"
Below is my code, I tried some other lines even closer to the examples given but they also did not work, just gave me more errors. What am I missing? Thanks in advance.
`const path = require('path');
const fs = require('fs');
// READS ALL FILES IN VIDEO FOLDER //
//joining path of directory
const directoryPath = path.join(__dirname, './Videos');
//passsing directoryPath and callback function
fs.readdir(directoryPath, function (err, files) {
//handling error
if (err) {
return console.log('Unable to scan directory: ' + err);
}
//listing all files using forEach
files.forEach(function (file) {
// Do whatever you want to do with the file
console.log(file);
});
});`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.