Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PlatformUtils

Platform-specific tools.

Hierarchy

  • PlatformUtils

Index

Constructors

constructor

Properties

Static type

type: "browser" | "node"

Type of the currently running platform.

Static workdir

workdir: string

Methods

Static basename

  • basename(pathStr: string): string
  • Returns the basename of a file

    Parameters

    • pathStr: string

    Returns string

Static deleteDirectory

  • deleteDirectory(dir: string): Promise<{}>
  • Parameters

    • dir: string

    Returns Promise<{}>

Static deleteFile

  • deleteFile(dir: string, file: string): Promise<{}>
  • Parameters

    • dir: string
    • file: string

    Returns Promise<{}>

Static directory

  • directory(file: string): string
  • Parameters

    • file: string

    Returns string

Static dirname

  • dirname(pathStr: string): string
  • Returns the dirname of the file

    Parameters

    • pathStr: string

    Returns string

Static fileExist

  • fileExist(pathStr: string): boolean
  • Synchronously checks if file exist. Does "fs.existsSync".

    Parameters

    • pathStr: string

    Returns boolean

Static filename

  • filename(pathStr: string): string
  • Returns the filename only (without extension)

    Parameters

    • pathStr: string

    Returns string

Static getEnvVariable

  • getEnvVariable(name: string): any
  • Gets environment variable.

    Parameters

    • name: string

    Returns any

Static getGlobalVariable

  • getGlobalVariable(): any
  • Gets global variable where global stuff can be stored.

    Returns any

Static getHostFileContent

  • getHostFileContent(): string
  • Returns string

Static getHostPath

  • getHostPath(): string
  • Returns string

Static isAbsolute

  • isAbsolute(pathStr: string): boolean
  • Test if path is absolute.

    Parameters

    • pathStr: string

    Returns boolean

Static isDir

  • isDir(pathStr: string): boolean
  • Parameters

    • pathStr: string

    Returns boolean

Static isFile

  • isFile(pathStr: string): boolean
  • Parameters

    • pathStr: string

    Returns boolean

Static join

  • join(...args: string[]): string
  • Parameters

    • Rest ...args: string[]

    Returns string

Static load

  • load(name: string): any
  • Loads ("require"-s) given file or package. This operation only supports on node platform

    Parameters

    • name: string

    Returns any

Static mkdir

  • mkdir(targetDir: string, sep?: string): boolean
  • Parameters

    • targetDir: string
    • Optional sep: string

    Returns boolean

Static pathExtname

  • pathExtname(pathStr: string, dotted?: boolean): string
  • Gets file extension. Does "path.extname".

    Parameters

    • pathStr: string
    • Optional dotted: boolean

    Returns string

Static pathNormAndResolve

  • pathNormAndResolve(pathStr: string): string
  • Resolved given path. Does "path.resolve".

    Parameters

    • pathStr: string

    Returns string

Static pathNormalize

  • pathNormalize(pathStr: string): string
  • Normalizes given path. Does "path.normalize".

    Parameters

    • pathStr: string

    Returns string

Static pathNormilize

  • pathNormilize(pathStr: string): string
  • Normalizes given path. Does "path.normalize".

    Parameters

    • pathStr: string

    Returns string

Static pathResolve

  • pathResolve(pathStr: string): string
  • Resolved given path. Does "path.resolve".

    Parameters

    • pathStr: string

    Returns string

Static pathResolveAndNormalize

  • pathResolveAndNormalize(pathStr: string): string
  • Normalizes given path. Does "path.normalize".

    Parameters

    • pathStr: string

    Returns string

Static readFile

  • readFile(filename: string): Promise<Buffer>
  • Parameters

    • filename: string

    Returns Promise<Buffer>

Static readFileSync

  • readFileSync(filename: string): Buffer
  • Parameters

    • filename: string

    Returns Buffer

Static setWorkDir

  • setWorkDir(workdir: string): void
  • set workdir

    Parameters

    • workdir: string

    Returns void

Static testForFilePath

  • testForFilePath(path: string): boolean
  • Parameters

    • path: string

    Returns boolean

Static withoutInterpolation

  • withoutInterpolation(str: string, fn: (str: string) => string): string
  • Parameters

    • str: string
    • fn: (str: string) => string
        • (str: string): string
        • Parameters

          • str: string

          Returns string

    Returns string

Generated using TypeDoc