What problem does it solve?
Scala Golem agents compile to JavaScript via Scala.js and run in a QuickJS-based WASM runtime, so standard JVM file I/O (java.io.File, java.nio.file) does not work. This Skill shows how to perform filesystem operations correctly using the node:fs module through Scala.js interop.
Core Features & Use Cases
- Scala.js Facade for node:fs: Define @JSImport facades for readFileSync, writeFileSync, appendFileSync, existsSync, readdirSync, and mkdirSync.
- Wizer-Safe Initialization: Use lazy val to defer node:fs imports past the build-time pre-initialization phase, avoiding runtime failures.
- Text and Binary File Handling: Read UTF-8 text files and binary files as Uint8Array, write and append files, and list directories.
- Use Case: Build a Golem agent that reads a provisioned config file at /data/config.json and appends log entries to /tmp/agent.log across invocations with durable per-agent storage.
Quick Start
Show me how to read a text file and append to a log file from my Scala Golem agent using node:fs.