@warlock.js/fs
A pocket-size filesystem toolkit — one fs object with everything: files,
directories, handles, hashing. The shape you wish node:fs had, minus the
graveyard of single-purpose dependencies (fs-extra, rimraf, mkdirp,
write-file-atomic, hasha) you’d otherwise reach for.
You import one thing and reach for it the way you’d reach for console.
fs.files.* handles files, fs.dirs.* handles directories, fs.file() and
fs.dir() give you lazy handle objects, and fs.hash.* fingerprints anything.
No factory, no config, no setup.
The whole idea, in one example
Section titled “The whole idea, in one example”Write JSON, read it back typed, patch it in place, then walk a tree — all
through fs:
import { fs } from "@warlock.js/fs";
// Write JSON — parent dirs auto-created, pretty-printed.await fs.files.putJson("./build/manifest.json", { version: "1.0.0" });
// Read it back, fully typed.const manifest = await fs.files.getJson<{ version: string }>("./build/manifest.json");
// Read → transform → write, atomically, in one call.await fs.files.editJson("./build/manifest.json", m => ({ ...m, built: Date.now() }));
// Walk the whole tree (recursive by default), files and folders alike.for await (const entry of fs.dirs.walk("./build")) { console.log(entry.type, entry.path);}That’s the entire vocabulary: nouns (files, dirs) and verbs
(putJson, editJson, walk). No naming ceremony to memorize.
Explore the guides
Section titled “Explore the guides”Where to start
Section titled “Where to start”- Introduction — what
fsgives you over rawnode:fs/promises. - Installation — one
yarn add, no wiring. - Your first write — a five-minute
fs.files.put+fs.files.getwalkthrough.
Then dip into the guides for task-oriented walkthroughs, or the reference for the full surface.