Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "src/utils/fs"

Index

Functions

createMatchers

  • createMatchers(...patterns: string[]): IMinimatch[]
  • Create Minimatch matchers for each of the specified patterns.

    Parameters

    • Rest ...patterns: string[]

      The glob-style patterns.

    Returns IMinimatch[]

    The matchers.

findFiles

  • findFiles(baseDir: string, globPattern: string, ...excludeGlobPatterns: string[]): Promise<string[]>
  • Find all files and directories matching a specific pattern.

    Parameters

    • baseDir: string

      The base directory in which to start searching.

    • globPattern: string

      A globbing pattern describing the files to find.

    • Rest ...excludeGlobPatterns: string[]

    Returns Promise<string[]>

readJson

  • readJson<T>(fileName: string): Promise<T>
  • Read and parse file contents as JSON.

    Type parameters

    • T

    Parameters

    • fileName: string

      The name of the file to read.

    Returns Promise<T>

    The deserialised data.

readJsonSync

  • readJsonSync<T>(fileName: string): T
  • Synchronously read and parse file contents as JSON.

    Type parameters

    • T

    Parameters

    • fileName: string

      The name of the file to read.

    Returns T

    The deserialised data.

readYaml

  • readYaml<T>(fileName: string, expectedYamlMimeType?: string): Promise<T>
  • Read and parse YAML from file contents.

    Type parameters

    • T

    Parameters

    • fileName: string

      The name of the file to read.

    • Optional expectedYamlMimeType: string

      An optional YAML MIME-type that must be matched (the file should start with "### YamlMime:expectedYamlMimeType").

    Returns Promise<T>

    The deserialised data.

readYamlFrontMatter

  • readYamlFrontMatter<T>(fileName: string): Promise<T>
  • Read and parse YAML front-matter from file contents.

    Type parameters

    • T

    Parameters

    • fileName: string

      The name of the file to read.

    Returns Promise<T>

    The deserialised data.

Generated using TypeDoc