-
Notifications
You must be signed in to change notification settings - Fork 7
Home
m0rtadelo edited this page Mar 8, 2019
·
12 revisions
NPM Module to recursive read directory async (non blocking). Returns Promise. Configurable, with callback for extended filtering and progress status. Quiet, NO dependencies. As non blocking module it is perfect to be used in any javascript based Desktop applications.
This module uses Promises and can't be used in old javascript engines.
The module has the next methods:
list | Returns a javascript object with directory items information (non blocking async with Promises) |
---|
Name | Type | Description |
---|---|---|
path | string | the path to start reading contents |
options | Options | options (mode, recursive, stats, ignoreFolders...) |
progress | fnCallback | callback with item data and progress info for each item |
An array of File/Folder objects
The returned array contains File
and Folder
objects with the next structure:
Field name | Field type | Description |
---|---|---|
name | string | The filename of the file |
path | string | The path of the file |
fullname | string | The fullname of the file (path & name) |
extension 1 | string | The extension of the file in lowercase |
isDirectory 2 | boolean | Always false in files |
data 3 | string(base64) | The content of the file in a base64 string |
stats 4 | stats | The stats (info) of the file |
Field name | Field type | Description |
---|---|---|
name | string | The name of the folder |
path | string | The path of the folder |
fullname | string | The fullname of the folder (path & name) |
extension 1 | string | The extension of the folder in lowercase |
isDirectory 2 | boolean | Always true in folders |
content 5 | File/Folder array | Array of File/Folder content |
Field name | Field type | Description |
---|---|---|
mode | LIST TREE | The list will return an array of items. The tree will return the items structured like the file system. Default: list |
- 1 exist when extensions = true
- 2 exist when ignoreFolders = false, stats = true, readContent = true, recursive = true or mode = TREE
- 3 exist when readContent = true
- 4 exist when stats = true
- 5 exist when recursive = true and mode = TREE