Skip to content

file_write

Gate: gated on file, target the workspace-relative path being written · write

Write a text file. This is where the file kind actually asks: the target is the path, and the approval offers one widening — the containing directory (notes/todo.md → notes/*). Parent directories are created as needed. See the file kind.

Input

FieldTypeRequiredNotes
pathstringyesWorkspace-relative path, e.g. notes/todo.md.
contentstringyesThe text to write. Replaces the file if it exists.

Output

What was written, and how much:

{ "path": "notes/todo.md", "bytesWritten": 214 }

From JavaScript

await nocturn.fs.writeFile("notes/todo.md", "buy milk\n");

Notes

A write replaces the file whole — there is no append tool. Read, change, write back if you need to add to something.