Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FileParser

File Parser

An extension of {@link Parser | Parser} that supports reading data from files when generating reports.

Hierarchy

Index

Constructors

constructor

Methods

Protected createBuilder

  • Create a ReportBuilder from the given options

    Parameters

    • Optional rootDirectory: undefined | string

      base directory that all paths are relativized from

    • Default value mode: ReportMode = ReportMode.Simple

      The type of builder that should be created. Defaults to Simple

    Returns ReportBuilder

    ReportBuilder

parse

  • parse(filePath: string, options?: object): Promise<Report>
  • Parse (Asynchronously)

    Parse an input with the given options and return a Promise of a Report.

    Parameters

    • filePath: string

      path to file that contains data to parse

    • Default value options: object = {}

      Optional options to control how the report is generated:

      • encoding - the type of encoding of the input data
      • rootDirectory - base directory that all paths are relativized from
      • mode - The type of Report that should be built
      • Optional encoding?: undefined | string
      • Optional mode?: ReportMode
      • Optional rootDirectory?: undefined | string

    Returns Promise<Report>

    Promise that resolves with a parsed Report

Protected parseContents

  • parseContents(contents: string, rootDirectory?: undefined | string, mode?: ReportMode): Report
  • Parse the string contents and return a Report

    Parameters

    • contents: string

      string containing input that should be parsed

    • Optional rootDirectory: undefined | string

      base directory that all paths are relativized from

    • Optional mode: ReportMode

      The type of builder that should be created

    Returns Report

    Parsed Report

parseSync

  • parseSync(filePath: string, options?: object): Report
  • Parse (Synchronously)

    Parse an input with the given options and return a Report.

    Parameters

    • filePath: string

      path to file that contains data to parse

    • Default value options: object = {}

      Optional options to control how the report is generated:

      • encoding - the type of encoding of the input data
      • rootDirectory - base directory that all paths are relativized from
      • mode - The type of Report that should be built
      • Optional encoding?: undefined | string
      • Optional mode?: ReportMode
      • Optional rootDirectory?: undefined | string

    Returns Report

    Parsed Report

Generated using TypeDoc