File System
Read and write files by mounting a host directory into the sandbox.
import type { ExportedHandler } from "kyushu-types";import { writeFileSync, readFileSync } from "node:fs";
export default { async fetch() { writeFileSync("/data/hello.txt", "Hello from Kyushu!"); const content = readFileSync("/data/hello.txt", "utf8");
return { status: 200, headers: { "content-type": "text/plain" }, body: content, }; },} satisfies ExportedHandler;Config
Section titled “Config”By default, the sandbox has no access to the host filesystem. Mount a directory to expose it to your worker.
[[mounts]]host = "."guest = "/"writable = trueTry it
Build and run the worker with its config.
kyu build && kyu run kyushu.run.tomlThen send a request to test it.
curl http://localhost:5987