SymlinkCapable
Defined in: packages/core/src/kernel/types.ts:1666
A fileserver that supports symbolic link creation, reading, and resolution.
Implement on a Fileserver to participate in cross-mount symlink resolution — the kernel delegates the walk so absolute targets and .. escapes can cross mount boundaries.
Remarks
Section titled “Remarks”Fileservers that are NOT SymlinkCapable are treated as having no symlink
semantics: readlink() fails with ENOSYS, stat(..., { nofollow: true })
behaves like plain stat, paths within them return verbatim.
Caveat
Section titled “Caveat”resolve() is a pure walk invoked by the kernel BEFORE dispatching
the actual op; it may escape this fileserver entirely (see
WalkResult). open() / stat() etc. are only invoked with a
'node' result.
Example
Section titled “Example”import type { SymlinkCapable } from '@fishnet/core'const links = new Map<string, string>()const ops: Pick<SymlinkCapable, 'symlink' | 'readlink'> = { async symlink(target, path) { links.set(path, target) }, async readlink(path) { const t = links.get(path); if (t === undefined) throw new Error('ENOENT'); return t },}- isSymlinkCapable
- WalkResult
- ResolutionOpts
- SYMLINK_LIMIT
Methods
Section titled “Methods”readlink()
Section titled “readlink()”readlink(
path):Promise<string>
Defined in: packages/core/src/kernel/types.ts:1682
Read the target of a symlink.
Parameters
Section titled “Parameters”InnerPath
Returns
Section titled “Returns”Promise<string>
Invariant
Section titled “Invariant”Returns the raw stored target string — relative targets are NOT expanded; callers join relative targets against the symlink’s directory themselves
resolve()
Section titled “resolve()”resolve(
path,opts):Promise<WalkResult>
Defined in: packages/core/src/kernel/types.ts:1693
Resolve a path with symlink following.
Parameters
Section titled “Parameters”InnerPath
ResolutionOpts
Returns
Section titled “Returns”Promise<WalkResult>
Invariant
Section titled “Invariant”Returns { kind: 'node' } when resolution stays within this
server, or an escape variant when the walk crosses this server’s
root — the kernel re-resolves escapes through the namespace
Invariant
Section titled “Invariant”Must decrement opts.depthRemaining for each symlink traversed;
depthConsumed on escapes tells the kernel how many steps to
subtract from its own budget
symlink()
Section titled “symlink()”symlink(
target,path):Promise<void>
Defined in: packages/core/src/kernel/types.ts:1674
Create a symbolic link at path pointing to target.
Parameters
Section titled “Parameters”target
Section titled “target”string
InnerPath
Returns
Section titled “Returns”Promise<void>
Invariant
Section titled “Invariant”target is stored verbatim — the server does NOT resolve it at
creation time. Target resolution happens on every traversal
via the kernel’s walk loop