Version: v0.7.0 - Beta.  We welcome contributors & feedback.

File.readDir

File.readDir($dirPath, $options = {}) -> list

Description

Read a directory, and return the contents as a List of paths.

The $dirPath and the returned paths are relative to the data/files directory.

File.readDir('someDir')

// e.g. [
//    'someDir/file1.txt',
//    'someDir/file2.txt',
// ]

Options

Option Value Description
filter files, dirs, all Type of contents to include
deep true/false Include contents of subdirectories
File.readDir('someDir', { filter: 'dirs' })
// e.g. [
//    'someDir/subdir1',
//    'someDir/subdir2',
// ]

File.readDir('someDir', { filter: 'all' })
// e.g. [
//    'someDir/file1.txt',
//    'someDir/file2.txt',
//    'someDir/subdir1',
//    'someDir/subdir2',
// ]

File.readDir('someDir', -deep)
// e.g. [
//    'someDir/file1.txt',
//    'someDir/file2.txt',
//    'someDir/subdir1/file3.txt'
// ]

See Also