Skip to content
Advertisement

Tag: readdir

fs.readdir ignore directories

I would like to scan the folder, but ignore all the folders/directories that are included in it. All I have in the (C:/folder/) are .txt files and other folders, I just want to scan the txt files, and ignore the folders. Answer Use fs.readdir or fs.readdirSync method with options { withFileTypes: true } and then do filtration using dirent.isFile (requires

Advertisement