Export a DataPackage object for local caching purposes.
It is recommended to export/import any data packages ahead of time to reduce unnecessary calls to DataPackageManager.fetchPackage and reduce connection startup time and lighten network overhead. See below for an example.
import fs from "node:fs";
import { Client } from "archipelago.js";
// ... misc client code (connecting and fetching data package).
// Save data package to a local file.
const data = client.package.exportPackage();
fs.writeFileSync("path/to/cache/datapackage_cache.json", JSON.stringify(data), "utf8");
Fetches and returns the DataPackage from the server, if the games are not locally cached or checksums do not match.
A list of game packages to fetch. If omitted, will fetch all available game packages from the current room.
If true, after fetching the data package, any changes will automatically be updated without
needing to manually call DataPackageManager.importPackage.
Returns the package metadata helper object for a specified game. If game package does not exist in cache, returns
null instead.
The specific game package to look up.
Import a DataPackage object to prepopulate local cache.
The package to import.
It is recommended to export/import any data packages ahead of time to reduce unnecessary calls to DataPackageManager.fetchPackage and reduce connection startup time and lighten network overhead. See below for an example.
import fs from "node:fs";
import { Client } from "archipelago.js";
const data = fs.readFileSync("path/to/cache/datapackage_cache.json");
const client = new Client();
client.package.importPackage(JSON.parse(data));
await client.login("wss://archipelago.gg:38281", "Phar", "Clique");
<script src="archipelago.js" type="module">
import { Client } from "archipelago.js";
const data = localStorage.getItem("datapackage_cache");
const client = new Client();
client.package.importPackage(JSON.parse(data));
await client.login("wss://archipelago.gg:38281", "Phar", "Clique");
</script>
Lookup an item name by its integer id.
The name of the game this item is associated with.
The id of the item to name lookup.
If true, returns "Unknown Item {id}" instead of undefined, if id does not exist in package.
Defaults to true, if omitted.
Lookup an item name by its integer id.
The name of the game this item is associated with.
The id of the item to name lookup.
If true, returns "Unknown Item {id}" instead of undefined, if id does not exist in package.
Defaults to true, if omitted.
Lookup a location name by its integer id.
The name of the game this location is associated with.
The id of the location to name lookup.
If true, returns "Unknown Location {id}" instead of undefined, if id does not exist in
package. Defaults to true, if omitted.
Lookup a location name by its integer id.
The name of the game this location is associated with.
The id of the location to name lookup.
If true, returns "Unknown Location {id}" instead of undefined, if id does not exist in
package. Defaults to true, if omitted.
Managers data packages metadata and exposes name lookup methods.