Closed amercier closed 5 years ago
options.showDirectories
false
When set to true, includes an entry containing the directory.
true
# Directory structure: level1 ├── level2 │ ├── file2a │ └── file2b ├── file1a └── file1b
for await (const files of filesByDirectory(['level1']/*, { showDirectories: false }*/} )) { console.log(files); } // [ 'level1/file1a', 'level1/file1b' ] // [ 'level1/level2/file2a', 'level1/level2/file2b' ] for await (const files of filesByDirectory(['level1'], { showDirectories: true })) { console.log(files); } // [ 'level1', 'level1/file1a', 'level1/file1b' ] // [ 'level1/level2', 'level1/level2/file2a', 'level1/level2/file2b' ] for await (const [directory, ...files] of filesByDirectory(['level1'], { showDirectories: true })) { console.log(directory, files); } // level1 [ 'level1/file1a', 'level1/file1b' ] // level1/level2 [ 'level1/level2/file2a', 'level1/level2/file2b' ]
options.showDirectories
(default:false
)When set to
true
, includes an entry containing the directory.