Edge-first bash
A POSIX shell and coreutils anywhere JavaScript runs — including edge runtimes with no filesystem or child processes.
Sometimes you just want a shell — grep, sed, awk, pipes — but you're
somewhere without one: an edge function, a serverless handler, a browser. Because
Lifo is pure JavaScript with an in-memory filesystem and no native dependencies,
it runs where a real shell can't: Cloudflare Workers, Vercel Edge, Deno, or a
browser tab. No binary, no container, sub-millisecond boot.
A shell in a handler
import { Sandbox } from "@lifo-sh/core";
// Boot per request — it's cheap. Volatile by default: nothing persists.
const box = await Sandbox.create();
box.fs.writeFile("/tmp/log.txt", rawLogText);
const { stdout } = await box.commands.run(
"grep ERROR /tmp/log.txt | sed 's/^/[!] /' | sort | uniq -c | sort -rn",
);
return new Response(stdout);You get the real coreutils pipeline — 60+ commands including
grep, sed, awk, cut, sort, uniq, tr, head/tail, tar, jq-style
text munging — evaluated in-process against the box's virtual
filesystem.
Text processing without touching a disk
You don't need real files. Pipe data straight through with stdin:
const { stdout } = await box.commands.run("awk '{ sum += $1 } END { print sum }'", {
stdin: numbersOnePerLine,
});Why it fits the edge
- No cold start — there's no image to initialize; a box is a few objects.
- No native deps — nothing to compile or bundle a binary for; it tree-shakes like any dependency.
- Volatile is fine — edge invocations are ephemeral, and a box defaults to an in-memory filesystem with nothing to clean up.
Gotcha
Edge runtimes are constrained: no host filesystem, no child processes, ephemeral per-invocation state, and (outside a browser) no service worker — so live previews don't apply there. The shell, coreutils, text processing, and the in-memory filesystem do.
Next
- Commands — the full coreutils set and how to add your own.
- Browser vs Node — what changes across environments.