Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • FileHelpers

Index

Methods

Static getApplicationDirectory

  • getApplicationDirectory(path?: string): string
  • Gets the most relevant application directory. This is defined by taking the currently executing file folder, and checking or moving up until the directory is no longer inside a node_modules folder.

    Parameters

    • Default value path: string = ""

      (Optional) If provided, attempts to lookup from the from directory.

    Returns string

    The most relevant application directory.

Static getMainDirectory

  • getMainDirectory(): string | boolean
  • Heuristic for guessing main directory. This includes resolving the following use cases:

    1) ./node_modules/.bin scripts 2) ./node_modules/PACKAGE_NAME/file scripts 3) ./SUBDIR/file calls

    The first non-node_modules folder with a package.json in it is used.

    Returns string | boolean

Static getPackageDirectory

  • getPackageDirectory(path?: undefined | string): string | boolean
  • Gets the directory of a package.

    Parameters

    • Optional path: undefined | string

      The path from which to look for the package directory.

    Returns string | boolean

    The directory containing the package.json file.

Static getPackageFile

  • getPackageFile(path?: undefined | string): string | boolean
  • Gets the package.json given a file path. If not found in the filepath directory, moves up a directory.

    Parameters

    • Optional path: undefined | string

    Returns string | boolean

    False if no file is found.

Static normalize

  • normalize(path: string): string

Legend

  • Constructor
  • Property
  • Method
  • Constructor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc