Class File

Hierarchy

Constructors

Properties

name: string
path: string[]

Methods

  • Returns true if the file is in missmatch.

    Parameters

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

    Returns boolean

  • 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

  • Similar to unzip, but uses a whitelist approach

    Parameters

    • path: Dir
    • files: string[]
    • Optional zipDir: Dir

    Returns Promise<void>

  • 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

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

    Parameters

    • expected: string | string[]

    Returns boolean

  • Parameters

    • url: string
    • Optional key: string
    • Optional chk: {
          sha1?: string | string[];
          size?: number;
      }
      • Optional sha1?: string | string[]
      • Optional size?: number
    • Optional opt: {
          executable?: string | boolean;
          unzip?: {
              exclude?: string[];
              file: Dir;
          };
      }
      • Optional executable?: string | boolean
      • Optional unzip?: {
            exclude?: string[];
            file: Dir;
        }
        • Optional exclude?: string[]
        • file: Dir

    Returns DownloadableFile

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

    Type Parameters

    • T

    Returns T

  • Similar to extract, but uses a blacklist approach

    Parameters

    • path: Dir
    • Optional exclude: string[]
    • Optional zipDir: Dir

    Returns Promise<void>

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

    Parameters

    • data: string | object | ArrayBuffer

    Returns void

Generated using TypeDoc