Class File

Hierarchy

Constructors

Properties

name: string
path: string[]

Methods

  • Returns true if the file matches what is expected.

    Parameters

    • Optional chk: {
          sha1?: string | string[];
          size?: number;
      }
      • Optional sha1?: string | string[]
      • Optional size?: number

    Returns boolean

  • Sets the execution bit on a set file, used on Linux and Mac systems

    Returns void

  • Copies this file or directory to a set location

    Parameters

    Returns void

  • Downloads a set file using fetch internally

    Parameters

    • url: string

      The url of the file you want to download

    • Optional chk: {
          sha1?: string | string[];
          size?: number;
      }

      The file check

      • Optional sha1?: string | string[]
      • Optional size?: number
    • Optional opt: {
          noRetry?: true;
          onReDownload?: ((file) => void);
          signal?: AbortSignal;
      }
      • Optional noRetry?: true
      • Optional onReDownload?: ((file) => void)
          • (file): void
          • Parameters

            Returns void

      • Optional signal?: AbortSignal

    Returns Promise<File>

    this object to allow for chaining

  • Checks if this file exists

    Returns boolean

  • Gets a new directory relative to this directory

    Parameters

    • Rest ..._file: string[]

    Returns Dir

  • Gets a new file relative to this directory

    Parameters

    • Rest ..._file: string[]

    Returns File

  • gets the hash of this file

    Parameters

    • algorithm: string = "sha1"

    Returns string

  • Returns Promise<boolean>

  • Checks if a directory is a symbolic link

    Returns boolean

  • Checks if a directory or file is in a relative or absolute state

    Returns boolean

  • Returns a java path off this directory or file

    Returns string

  • Creates a system link to a set file or directory using this file or folder as the the placeholder for the link (similar to linkTo)

    Parameters

    • path: string | string[] | File

    Returns void

  • Creates a system link to this file and puts the link at the destination file that was provided as input (similar to linkFrom)

    Parameters

    • dest: string | string[] | File

    Returns void

  • Loads a json object from the file system and adds some shortcut functions to make it easier to save.

    Type Parameters

    • T

    Parameters

    • def: T
    • serializer: ((raw) => T) = ...
        • (raw): T
        • Parameters

          • raw: T

          Returns T

    Returns T & WrappedObj

  • Reads a file and returns it as a string

    Returns string

  • Reads a file and returns the raw array buffer

    Returns Buffer

  • Checks if an expected hash matches with this object. (@see getHash)

    Parameters

    • expected: string | string[]

    Returns boolean

  • Checks if the size value given matches with this object. (@see getSize)

    Parameters

    • expected: number

    Returns boolean

  • Return the system path of a file

    Returns string

  • Returns a base64 representation of the file

    Returns string

  • Reads a set file and returns a json representation of that object

    Type Parameters

    • T

    Returns T

  • Parameters

    • path: Dir
    • opt: {
          exclude?: string[];
          include?: string[];
          zipDir?: Dir;
      } = {}
      • Optional exclude?: string[]
      • Optional include?: string[]
      • Optional zipDir?: Dir

    Returns Promise<void>

  • Turns an object into a wrappedObj. Essentially this just adds functions to make it easier to save.

    Type Parameters

    • T

    Parameters

    • obj: T

    Returns T & WrappedObj

  • Writes data to file. Automatically converts JSON objects to parsable strings before saving them

    Parameters

    • data: string | object | ArrayBuffer

    Returns void

Generated using TypeDoc