Skip to content
m0rtadelo edited this page Mar 8, 2019 · 12 revisions

Welcome to the recursive-readdir-async wiki!

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.

Main methods

The module has the next methods:

list Returns a Promise object with directory items information

Parameters:

Name Field type Description
path string the path to start reading contents
options OptionsHome:Objects:Options options (mode, recursive, stats, ignoreFolders...)
progress fnCallback callback with item data and progress info for each item

Returns:

An array of File/Folder objects

Objects

File:

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

Folder:

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

Options:

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
Clone this wiki locally