1.0.6 • Published 2 years ago

readfolder-recursive v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Read Folder Recursive Accepts the path of a folder and returns all the files included in the folder and its subfolders. npm i readfolder-recursive Arguments 1. The path of the folder (required) 2. An array with file extensions ".png", ".mp4". Only the files that their extensions matches would be returned. An empty array will return all the files. (optional) 3. An array with file extensions to ignore. The files with these extnesions would not be returned. (optional) ****If an extension is include in both arrays, files with this extension would not be returned.

Usage - Returns a Promise

Example 1 const readFolderRecursive = require('readfolder-recursive'); const path = "C:\Users\myUsername\Desktop\myFolder"; const extensionsToInclude = []; //An empty array means include all the files. const extensionsToIgnore = ".mp4"; //Ignore all the .mp4 files. const files = await readFolderRecursive(path, extensionsToInclude, extensionsToIgnore); It will return all the files from the folder "C:\Users\myUsername\Desktop\myFolder" apart from the .mp4 files Example 2 const readFolderRecursive = require('readfolder-recursive'); const path = require('path'); const folder = path.join('__dirname', 'myFolder'); readFolderRecursive(folder, [], []) .then((files)=>{ console.log(files) }) .catch((e)=>{ console.log(e) }); It will return all the files from the folder "myFolder"

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago