SiYuan icon

SiYuan

Manage SiYuan notebooks, documents, blocks, attributes, and more. Designed for AI agent workflows.

Asset → Put File

AI-generated

Summary

Create or overwrite a file or directory in the SiYuan workspace at the specified path.

Inputs

  • filePath (required) — The path of the file or directory within the SiYuan workspace (must start with /).
  • fileContent (required) — The content to write to the file (plain text string).
  • putFileOptions.isDir — Whether to create a directory instead of a file (defaults to false).

Output shape

no body — success/failure only

The operation returns null on success and throws an error on failure.

Examples

Example 1: Create a text file

Set filePath to '/data/example.txt' and fileContent to 'Hello SiYuan'.

Example 2: Create a directory

Set filePath to '/data/my_folder', fileContent to any value, and putFileOptions.isDir to true.

Links

Discussion