Options
All
  • Public
  • Public/Protected
  • All
Menu

file-hierarchy - Turn an entire directory tree into a js-hierarchy node

Hierarchy

  • AbstractNode
    • FileNode

Implements

  • Node

Index

Constructors

constructor

  • new FileNode(name?: string, data?: object): FileNode
  • Parameters

    • Optional name: string
    • Optional data: object
      • [p: string]: any

    Returns FileNode

Properties

Protected _log

_log: loglevel.Logger

Private _path

_path: string

Private _stats

_stats: Stats

Private _type

name

name: string

Accessors

path

  • get path(): string
  • set path(value: string): void

stats

  • get stats(): Stats
  • set stats(value: Stats): void
  • The fs.Stats object assigned to this node

    Returns Stats

  • The fs.Stats object assigned to this node

    Parameters

    • value: Stats

    Returns void

type

Methods

addChild

  • addChild(child: Node, position?: number): Node
  • Parameters

    • child: Node
    • Optional position: number

    Returns Node

findChild

  • findChild(child: Node): number
  • Parameters

    • child: Node

    Returns number

getChildByName

  • getChildByName(name: string): Node
  • Parameters

    • name: string

    Returns Node

getChildren

getData

  • getData(key: string): any
  • Parameters

    • key: string

    Returns any

getLevel

  • getLevel(): number
  • Returns number

getNodeByPath

  • getNodeByPath(path: string, pathSeparator?: string): Bluebird<Node>
  • Parameters

    • path: string
    • Optional pathSeparator: string

    Returns Bluebird<Node>

getNodeByPathArray

  • getNodeByPathArray(pathNodes: Array<string>, absolute: boolean): Bluebird<Node>
  • Parameters

    • pathNodes: Array<string>
    • absolute: boolean

    Returns Bluebird<Node>

getParent

  • getParent(): Node
  • Returns Node

getPath

  • getPath(pathSeparator?: string): Bluebird<string>
  • Parameters

    • Optional pathSeparator: string

    Returns Bluebird<string>

getPathNodes

  • getPathNodes(): Bluebird<Array<Node>>
  • Returns Bluebird<Array<Node>>

getRoot

  • getRoot(): Node
  • Returns Node

isRoot

  • isRoot(): boolean
  • Returns boolean

removeChild

  • removeChild(child: Node | number): void
  • Parameters

    • child: Node | number

    Returns void

scan

  • Scan a directory tree and generate a node from it and its children

    Parameters

    • options: ScanOptionsInterface

      Options for the scan

    • Default value rootNode: boolean = true

      Are we in the root node? (used by recursive scans)

    Returns Bluebird<FileNode>

    the generated node

setData

  • setData(key: string, value: any): Node
  • Parameters

    • key: string
    • value: any

    Returns Node

setParent

  • setParent(node: Node): void
  • Parameters

    • node: Node

    Returns void

toJSON

  • toJSON(): string
  • Returns string

walk

  • walk(direction: Direction | Direction[], action: ActionFunction): Bluebird<void>
  • Parameters

    • direction: Direction | Direction[]
    • action: ActionFunction

    Returns Bluebird<void>

Generated using TypeDoc