Options
All
  • Public
  • Public/Protected
  • All
Menu

Utilities API.

Hierarchy

  • UtilAPI

Index

Properties

DomUtils

DomUtils: { mkElement: any }

DOM utilities

Type declaration

  • mkElement: function
    • mkElement(type: string, classes?: string[]): HTMLElement
    • Creates a HTML element.

      Parameters

      • type: string

        The type of element.

      • Optional classes: string[]

        The classes to add.

      Returns HTMLElement

INI

INI: INIAPI

INI API.

argParser

argParser: { parse: any; stripOptions: any }

Argument parsing API.

Type declaration

  • parse: function
    • parse(input: string): string[]
    • Parse a command string.

      Parameters

      • input: string

        The argument string to parse.

      Returns string[]

  • stripOptions: function
    • stripOptions(startIndex: number, a: string[], filter: string[]): boolean
    • Strips the options from an argument array.

      Parameters

      • startIndex: number

        Where to start stripping.

      • a: string[]

        The argument array to use.

      • filter: string[]

        The filter to use.

      Returns boolean

cli

cli: { ProgressBar: { prototype: ProgressBarInstance }; Spinner: { prototype: SpinnerInstance } }

CLI utilities.

Type declaration

sizeFmt

sizeFmt: SizeFormatter

Size formatting API.

uuid

uuid: { generateV4: any }

UUID API.

Type declaration

  • generateV4: function
    • generateV4(): string
    • UUIDv4 Function

      Returns string

Methods

blobToDataURI

  • blobToDataURI(blob: Blob): Promise<string>
  • Converts a blob to data URI.

    Parameters

    • blob: Blob

      The blob to convert.

    Returns Promise<string>

clampNum

  • clampNum(min: number, max: number, n: number): number
  • Clamps a number within the specified range.

    Parameters

    • min: number

      The minimum value.

    • max: number

      The maxmimum value.

    • n: number

      The number to use.

    Returns number

dataURItoBlob

  • dataURItoBlob(uri: string): Promise<Blob>
  • Converts a data URI to Blob.

    Parameters

    • uri: string

      The data URI to convert.

    Returns Promise<Blob>

escapeHtml

  • escapeHtml(unsafe: string): string
  • Escapes HTML.

    Parameters

    • unsafe: string

      The HTML to escape.

    Returns string

getMimetype

  • getMimetype(extension: string): string
  • Resolves a mimetype from extension.

    Parameters

    • extension: string

      The extension of the file to resolve the mimetype for.

    Returns string

getMimetypeFromPath

  • getMimetypeFromPath(path: string): string
  • Resolves a mimetype from file path.

    Parameters

    • path: string

      The path of the file to retrieve the mimetype of.

    Returns string

inspect

  • inspect(obj: any, opts: any): any
  • Echos the value of a value. Trys to print the value out in the best way possible given the different types.

    license

    MIT (© Joyent)

    Parameters

    • obj: any

      The object to print out.

    • opts: any

      Optional options object that alters the output.

    Returns any

isDataURL

  • isDataURL(input: string): boolean
  • Checks whether a string is a data URL.

    Parameters

    • input: string

      The data URL to check.

    Returns boolean

isURL

  • isURL(input: string): boolean
  • Returns whether the specified string is a URL.

    Parameters

    • input: string

      The string to check.

    Returns boolean

rand

  • rand(min: number, max: number): number
  • Generates a random number between min and max.

    Parameters

    • min: number

      The minimum value.

    • max: number

      The maximum value.

    Returns number

requestTerminal

  • requestTerminal(title: string, icon: string, noCBX?: boolean): Promise<TermRequest>
  • Request a console terminal window.

    Parameters

    • title: string

      Terminal window title.

    • icon: string

      Terminal window icon.

    • Optional noCBX: boolean

      Whether to disable the controlbox. Default = false.

    Returns Promise<TermRequest>

    XTermInterface

sideloadZip

  • sideloadZip(url: string): Promise<void>
  • Sideloads a zip to the system drive.

    Parameters

    • url: string

      The URL of the ZIP to sideload.

    Returns Promise<void>

wait

  • wait(ms: number): Promise<void>
  • Promisified setTimeout().

    Parameters

    • ms: number

      The number of seconds to timeout for.

    Returns Promise<void>

Generated using TypeDoc