Skip to main content

Assets

Overview

Assets are all files located in assets directory in root of plugin repository, be it image, text file or anything else. Asset files can be referenced in various predefined places in plugin manifest or code, or be imported as a byte array in your code

Icon of entrypoint

Every entrypoint can have an icon. For non-generated entrypoints this icon is defined in Plugin Manifest. See Plugin Manifest page for specific property

Image in component

Images in React views can also be fetched directly from assets

import { ReactElement } from "react";
import { Detail } from "@project-gauntlet/api/components";

export default function Example(): ReactElement {
return (
<Detail>
<Detail.Content>
<Detail.Content.Image source={{ asset: "logo.png" }}/>
</Detail.Content>
</Detail>
)
}
Gauntlet Screenshot

Byte array

Assets can also be fetched on demand as ArrayBuffer

import { assetData } from "@project-gauntlet/api/helpers";

export default async function Command() {
const data = await assetData("masterpiece.txt");
const decodedData = new TextDecoder().decode(data);
console.log(decodedData)
}