Skip to content

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

NameTypeDescription
isDirectoryfunctionFunction to check if the entity is a directory.
namestringName of the directory entity.

DirectoryFile

Represents a file within a directory with its details.

Kind: global typedef
Properties

NameTypeDescription
[ext]stringFile extension, if available.
[folder]stringFolder containing the file, if available.
isDirbooleanFlag to determine if the entity is a directory.
namestringName of the file.
pathstringFull path to the file.

DirectoryReader

Interface for reading directory contents.

Kind: global typedef
Properties

NameTypeDescription
isDirectoryfunctionChecks if the given entry is a directory.
readDirectoryfunctionReads the directory at the given path and returns its entities.

DirectoryTreeListOptions

Options for listing directory tree contents.

Kind: global typedef
Properties

NameTypeDescription
[exclude]Array.<string>Patterns to exclude from the tree.
[include]Array.<string>Patterns to include in the tree.
[mainPath]stringMain path for relative calculations.
srcPathstringSource 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

NameTypeDescription
[children]Array.<FileTree>Child nodes of the current node.
[ext]stringFile extension, if available.
[fullPath]stringFull path to the file or directory.
namestringName of the file or directory.
[path]stringRelative path to the file or directory.

FilterStrategy

Strategy for filtering directory contents.

Kind: global typedef
Properties

NameTypeDescription
shouldIncludefunctionDetermines if a given entry should be included based on the strategy.

DirectoryTreeResult

Kind: global typedef
Properties

NameTypeDescription
pathsArray.<DirectoryFile>The paths in the directory.
treeArray.<FileTree>The hierarchical tree structure of the directory.
excludedArray.<DirectoryFile>The files that were excluded based on the provided options.

Released under the MIT License.