Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "util"

Index

Functions

exists

  • exists(p: fs.PathLike): Promise<boolean>
  • Checks if a path exists.

    Parameters

    • p: fs.PathLike

      The path to check.

    Returns Promise<boolean>

    The promise, that indicates, if path exists or not.

getResourcePath

  • getResourcePath(p: any): string
  • Returns the full path inside the 'res' folder.

    Parameters

    • p: any

      The relative path.

    Returns string

    The full path.

isEmptyString

  • isEmptyString(val: any): boolean
  • Converts a value to a normalized string and checks if it is empty ('').

    Parameters

    • val: any

      The value to check.

    Returns boolean

    Is empty string ('') or not.

isFile

  • isFile(p: string | Buffer, useLSTAT?: boolean): Promise<boolean>
  • Checks if a path exists and is a directory.

    Parameters

    • p: string | Buffer

      The path to check.

    • Default value useLSTAT: boolean = false

    Returns Promise<boolean>

    The promise, that indicates, if is a directory or not.

loadEJS

  • loadEJS(p: any, data?: Data): Promise<string>
  • Loads an EJS template from 'res' folder.

    Parameters

    • p: any

      The relative path inside 'res/templates' without '.ejs' extension.

    • Optional data: Data

    Returns Promise<string>

    The promise with the rendered template.

loadResource

  • loadResource(p: any): Promise<Buffer>
  • Loads a file from 'res' folder.

    Parameters

    • p: any

      The relative path of the resource.

    Returns Promise<Buffer>

    The promise with the loaded data.

normalizeString

  • normalizeString(val: any): string
  • Converts a value to a lower case and trimmed string.

    Parameters

    • val: any

      The input value.

    Returns string

    The output value.

toStringSafe

  • toStringSafe(val: any): string
  • Converts a value to a string, if needed, that is not (null) and (undefined).

    Parameters

    • val: any

      The input value.

    Returns string

    The output value.

Generated using TypeDoc