Class Asar

A directory entry.

Hierarchy

Constructors

Properties

files: {
    [filename: string]: EntryData | undefined;
}

Type declaration

  • [filename: string]: EntryData | undefined
initialParseData?: AsarInitialParseData

Methods

  • Extracts the Asar archive to a directory

    Parameters

    • output: string

      The directory to extract to

    Returns Promise<void>

  • Gets the Asar archive data

    Parameters

    Returns {
        bytes: Uint8Array;
        header?: DirectoryEntryData;
        headerString?: string;
        rawHeader?: Uint8Array;
        rawHeaderSize?: number;
    }

    The Asar archive data, and more if specified in the options

    • bytes: Uint8Array

      The raw Asar archive data that can be saved to a file.

    • Optional header?: DirectoryEntryData
    • Optional headerString?: string
    • Optional rawHeader?: Uint8Array
    • Optional rawHeaderSize?: number
  • Gets the entry at the given path.

    Parameters

    • path: string | string[]

      The path or path chunks to get the entry at.

    Returns Entry

  • Lists all files in this directory. This is not recursive.

    Returns string[]

    A list of all files in this directory.

  • Reads a file from the Asar archive

    Parameters

    • path: string | string[] | Entry

      The path to the file inside the Asar archive

    Returns Uint8Array

    The file data

  • Gets the Asar archive data and saves it to a file

    Parameters

    • asarPath: string

      The path to save the Asar archive to

    • opts: Partial<AsarGetDataOptions> = {}

      Options passed to Asar.getData

    Returns Promise<void>

  • Walks through the directory and recursively yields all files and directories.

    Parameters

    • includeDirectories: boolean = true

      Whether to include directories in the result.

    • _path: null | string[] = null

      Used internally for recursion.

    Returns Generator<readonly [string, string[], Entry], void, unknown>

  • Writes to a file inside the Asar archive

    Parameters

    • path: string | string[]

      The path to the file inside the Asar archive

    • data: string | Uint8Array

      The data to write to the file

    • createDirs: boolean = false

      Whether to create directories in between if they don't exist

    Returns void

  • Creates a new Asar instance from a directory

    Parameters

    • inputDir: string

      The directory to read from

    • Optional opts: Partial<AsarOptions>

      Options for initialising the Asar instance

    Returns Promise<Asar>

    The Asar instance

  • Creates a new Asar instance from an Asar archive file

    Parameters

    • asarPath: string

      The path to the Asar archive file

    • Optional opts: Partial<AsarOptions>

      Options for initialising the Asar instance

    Returns Promise<Asar>

    The Asar instance

  • Checks wether the given value is an entry.

    Parameters

    • entry: unknown

      The value to check.

    Returns entry is Entry

  • Parameters

    • bytes: Uint8Array
    • offset: number
    • size: number

    Returns Uint8Array

Generated using TypeDoc