Class representing a document loader for loading Figma files. It extends the BaseDocumentLoader and implements the FigmaLoaderParams interface. The constructor takes a config object as a parameter, which contains the access token, an array of node IDs, and the file key.

Example

const loader = new FigmaFileLoader({
accessToken: "FIGMA_ACCESS_TOKEN",
nodeIds: ["id1", "id2", "id3"],
fileKey: "key",
});
const docs = await loader.load();

Hierarchy (view full)

Implements

Constructors

Properties

fileKey: string
nodeIds: string[]
accessToken?: string

Methods

  • Fetches the Figma file using the Figma API, creates a Document instance with the JSON representation of the file as the page content and the API URL as the metadata, and returns it.

    Returns Promise<Document[]>

    A Promise that resolves to an array of Document instances.

  • Loads the documents and splits them using a specified text splitter.

    Parameters

    • splitter: TextSplitter = ...

    Returns Promise<Document[]>

    A Promise that resolves with an array of Document instances, each split according to the provided TextSplitter.

Generated using TypeDoc