userFS
userFS(
initialUser?):Fileserver
Defined in: packages/core/src/kernel/fileservers/user.ts:54
Create the /dev/user fileserver exposing the current username as a single file.
Parameters
Section titled “Parameters”initialUser?
Section titled “initialUser?”string
Username to report at construction. Defaults to 'root'.
Returns
Section titled “Returns”A Fileserver hosting the single / = username device node.
Remarks
Section titled “Remarks”Mount at /dev/user. Reads the single file return ${username}\n; writes
replace username with the trimmed payload. The whoami bin reads this
file to print the current user; other bins may do the same as a
lightweight identity signal.
Instance is created per boot in builder.ts (not at module scope) — each boot gets its own username. Writes are visible to all processes sharing this boot’s namespace, since the underlying state is a captured closure variable on this fileserver instance.
mkdir, remove, rename, wstat all throw EPERM; any inner path
other than / throws ENOENT.
Example
Section titled “Example”import { userFS } from '@fishnet/core'const fs = userFS('alice')const fd = await fs.open('/', { read: true })const bytes = await fs.read(fd, 0, 64) // "alice\n"await fs.close(fd)Caveat
Section titled “Caveat”Phase A: writes are unrestricted — any process can change the
username. Per-process identity (uid-based, unforgeable) is
deferred; the Phase B plan replaces this server with a procFS
projection synthesized from proc.uid.