Yaml

The api.nexomaker.yaml namespace provides functions for writing and reading YAML files inside a Nexo Maker project. This allows developers to store configuration, data, or custom structures directly in the project’s file system.


Methods

yaml.writeFile()

Writes data to a YAML file in the specified project.

  • If the file already exists, it will be overwritten.

  • If the file does not exist, it will be created automatically.

const result = await api.nexomaker.yaml.writeFile({
  projectId: placeholders.projectId,
  fileName: "myfolder/test.yml",
  content: {
    x: 123,
    y: 456,
    project: placeholders.projectId,
    created_at: placeholders.timestamp(),
    note: "This file is in the project root directory!"
  }
});
  • projectId → The active project ID.

  • fileName → Path and name of the YAML file to write.

  • content → JavaScript object that will be written into the YAML file.


yaml.readFile()

Reads and parses a YAML file from the project (returns as an object).

  • Returns:

    • successtrue if the file was read successfully.

    • parsedContent → Parsed object from the YAML file.

    • error → Error message if the read failed.


api.nexomaker.getProjects()

Fetch a list of available projects.

api.nexomaker.project.loadNexoItems()

Load all Nexo items for the active project.

Last updated