Class: FileLoader

'brixy.fs.FileLoader'~ FileLoader

new FileLoader ()

FileLoader class. Subclass or instance should at least define own onLoadFile(file) method.

Source:

Methods

addPath (path)

Adds the include path without applying of the file filter.

Parameters:
Name Type Description
path string
Source:

alias (alias, path)

Creates alias of the folder path.

Parameters:
Name Type Description
alias string

Folder shortcut.

path string

Folder path relative to the home folder (alias for '') or absolute path.

Throws:
  • Exception if folder doesn't exist.

  • Exception if alias already exists for a different path.

Source:

aliasPath (alias)

Returns full path of the alias.

Parameters:
Name Type Description
alias string
Throws:
  • Exception if alias doesn't exist.

Source:

ignore (alias, path)

Stores path to the included list to prevent the further loading. Doesn't test if file exists.

Parameters:
Name Type Description
alias string

Folder shortcut.

path string

File or folder path.

Throws:
  • Exception if alias doesn't exist.

Source:

isAllowedFile (path) → {boolean}

Filters the file. Subclass or instance may define own fileFilter method.

Parameters:
Name Type Description
path string

Full path of the file.

Returns:
  • boolean
Source:

isAllowedFolder (path) → {boolean}

Filters the folder. Subclass or instance may define own fileFilter method.

Parameters:
Name Type Description
path string

Full path of the folder.

Returns:
  • boolean
Source:

isLoaded (path)

Tests if the path is already included.

Parameters:
Name Type Description
path string

Full path of the file.

Source:

load (alias, path)

Includes jsx|jsxinc|js|jsxbin file. Folders are traversed recursively. Each file is included only once.

Parameters:
Name Type Description
alias string

Folder shortcut.

path string

File or folder path.

Throws:
  • Exception if alias or file doesn't exist.

Source:

loadedPaths () → {Array.<string>}

Return the array of the included file paths.

Returns:
  • Array.<string> :
    • Array of the included file paths.
Source:

loadFile (file)

Loads the file if it is of an allowed type. Each file is loaded only once.

Parameters:
Name Type Description
file File | Folder

File or folder object.

Throws:
  • Exception if file doesn't exist.

Source:

onLoadFile (file)

Does nothing. Subclass or instance should define own onLoadFile method.

Parameters:
Name Type Description
file File
Source:

onLoadFolder (folder)

Loads files and folders. Folders are traversed recursively. Subclass or instance may define own onLoadFolder method.

Parameters:
Name Type Description
folder Folder
Source:

toString () → {string}

Returns a string representation of the object.

Returns:
  • string
Source: