directory-tree-builder
Classes
- DirectoryTreeBuilder
The
DirectoryTreeBuilder
class provides functionalities to construct a hierarchical representation of a directory and its contents based on the provided options. It leverages filtering strategies and directory readers to achieve this.
Typedefs
- DirectoryEntity
Represents a directory entity with basic information.
- DirectoryFile
Represents a file within a directory with its details.
- DirectoryReader
Interface for reading directory contents.
- DirectoryTreeListOptions
Options for listing directory tree contents.
- FileTree
Represents a node in a file tree structure.
- FilterStrategy
Strategy for filtering directory contents.
- DirectoryTreeResult
DirectoryEntity
Represents a directory entity with basic information.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
isDirectory | function | Function to check if the entity is a directory. |
name | string | Name of the directory entity. |
DirectoryFile
Represents a file within a directory with its details.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[ext] | string | File extension, if available. |
[folder] | string | Folder containing the file, if available. |
isDir | boolean | Flag to determine if the entity is a directory. |
name | string | Name of the file. |
path | string | Full path to the file. |
DirectoryReader
Interface for reading directory contents.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
isDirectory | function | Checks if the given entry is a directory. |
readDirectory | function | Reads the directory at the given path and returns its entities. |
DirectoryTreeListOptions
Options for listing directory tree contents.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[exclude] | Array.<string> | Patterns to exclude from the tree. |
[include] | Array.<string> | Patterns to include in the tree. |
[mainPath] | string | Main path for relative calculations. |
srcPath | string | Source path of the directory to list. |
[tree] | Array.<FileTree> | Existing tree to append to, if available. |
FileTree
Represents a node in a file tree structure.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
[children] | Array.<FileTree> | Child nodes of the current node. |
[ext] | string | File extension, if available. |
[fullPath] | string | Full path to the file or directory. |
name | string | Name of the file or directory. |
[path] | string | Relative path to the file or directory. |
FilterStrategy
Strategy for filtering directory contents.
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
shouldInclude | function | Determines if a given entry should be included based on the strategy. |
DirectoryTreeResult
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
paths | Array.<DirectoryFile> | The paths in the directory. |
tree | Array.<FileTree> | The hierarchical tree structure of the directory. |
excluded | Array.<DirectoryFile> | The files that were excluded based on the provided options. |