@sugoidogo/packwiz-extras-lib
    Preparing search index...

    Class PackwizPack

    This object contains all the functionality of packwiz-extras, and is the default export of this library.

    All instancing methods (new PackwizPack, loadPack, refreshPack, fetchPack) require a FileSystemDirectoryHandle as their first argument.

    In web browsers, you can use navigator.storage.getDirectory to use browser storage, or showDirectoryPicker to allow the user to select a folder on the host system.

    In node, you can use my node file system adapter (or any pollyfill/ponyfill that provides the Web File System API) to grant this library access to a host folder.

    Index

    Constructors

    • Creates a new, empty modpack

      Parameters

      • packDirectoryHandle: FileSystemDirectoryHandle
      • packName: string
      • versions: {
            fabric?: string;
            forge?: string;
            liteloader?: string;
            minecraft: string;
            neoforge?: string;
            quilt?: string;
        }
        • Optionalfabric?: string

          The version of Fabric loader used by this modpack.

        • Optionalforge?: string

          The version of Forge used by this modpack. This version must not include the Minecraft version as a prefix.

        • Optionalliteloader?: string

          The version of Liteloader used by this modpack.

        • minecraft: string

          The version of Minecraft used by this modpack. This should be in the format used by the version.json files.

        • Optionalneoforge?: string

          The version of NeoForge used by this modpack.

          This is an undocumented variable in packwiz, so this documentation may be inaccurate.

        • Optionalquilt?: string

          The version of Quilt loader used by this modpack.

      Returns PackwizPack

    Properties

    packDirectoryHandle: FileSystemDirectoryHandle

    The directory in which all pack files are stored

    packFileName: string

    The name of the PackMetaData file

    packFiles: ChangeTrackingMap<string, PackFileMetaData | Uint8Array<ArrayBuffer>>

    This object stores the contents of PackFileMetaData files referenced in the PackIndex

    packIndex: PackIndex
    packMetaData: PackMetaData

    Methods

    • In order to comply with curseforge API requirements, direct download URLs to curseforge files cannot be saved into the pack. Instead, you may use this function beforehand to cache the download URLs in memory before attempting to install the pack.

      Parameters

      Returns Promise<PackwizPack>

    • Hashes all non-metafiles in the pack and makes a request to curseforge to find matching files. Any file that matches is removed from the modpack and replaced with a metafile referencing the curseforge file.

      Parameters

      Returns Promise<PackwizPack>

    • Hashes all non-metafiles in the pack and makes a request to modrinth to find matching files. Any file that matches is removed from the modpack and replaced with a metafile referencing the modrinth file.

      Returns Promise<PackwizPack>

    • Uses the hashes stored in any non-modrinth metafiles to find files that are also availible from modrinth, then adds modrinth metadata (client/server side, download url, etc) to that file.

      Useful for metafiles that don't already have that meatadata availible, or for exporting your pack to multiple platforms.

      Returns Promise<PackwizPack>

    • Saves the in-memory modpack changes to storage. You must call this function after making any changes to the pack in order to preserve those changes.

      Parameters

      • Optionalhashes: boolean

        whether to calculate and include file hashes in the output. You should only change this to true when saving the pack for serving over HTTP, where hashes are required. Otherwise, this option is automatically set from pack options.

      Returns Promise<PackwizPack>

    • Fetches a modpack from an HTTP/HTTPS url

      Parameters

      • packDirectoryHandle: FileSystemDirectoryHandle
      • packUrl: string

      Returns Promise<PackwizPack>

    • Loads a modpack from storage

      Parameters

      • packDirectoryHandle: FileSystemDirectoryHandle
      • packFileName: string = "pack.toml"

      Returns Promise<PackwizPack>

    • Loads a modpack from storage, ignoring and rebuilding the index so that changes made outside of packwiz(-extras) are included.

      Parameters

      • packDirectoryHandle: FileSystemDirectoryHandle
      • packFileName: string = "pack.toml"

      Returns Promise<PackwizPack>