Node.Js: How to limit files recovered by fs.readdirSync?
I have a lot of folders. each folder has thousands of files.
I am using fs.readdirSync () to list all the files in a folder.
I need to limit this list to a specific number of files.
let's say to get 100 files just at a time.
is it doable?
to make everything work. I used a slice.
if(currentFiles.length > 100){
currentFiles = currentFiles.slice(0,100);
}
+3
source to share
No one has answered this question yet
Check out similar questions: