Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "file-utils"

Index

Variables

Functions

Variables

_BOM

_BOM: RegExp = /^\uFEFF/

Functions

getPath

  • getPath(path: string, options: EtaConfig): string
  • Get the absolute path to an included template

    If this is called with an absolute path (for example, starting with '/' or 'C:') then Eta will attempt to resolve the absolute path within options.views. If it cannot, Eta will fallback to options.root or '/'

    If this is called with a relative path, Eta will:

    • Look relative to the current template (if the current template has the filename property)
    • Look inside each directory in options.views

    Note: if Eta is unable to find a template using path and options, it will throw an error.

    Parameters

    • path: string

      specified path

    • options: EtaConfig

      compilation options

    Returns string

    absolute path to template

getWholeFilePath

  • getWholeFilePath(name: string, parentfile: string, isDirectory?: undefined | false | true): string
  • Get the path to the included file from the parent file path and the specified path.

    If name does not have an extension, it will default to .eta

    Parameters

    • name: string

      specified path

    • parentfile: string

      parent file path

    • Optional isDirectory: undefined | false | true

      whether parentfile is a directory

    Returns string

    absolute path to template

readFile

  • readFile(filePath: string): any
  • Reads a file synchronously

    Parameters

    • filePath: string

    Returns any

Generated using TypeDoc