Skip to content

HttpFSOpts

Defined in: packages/core/src/kernel/fileservers/http.ts:35

Options bag for httpFS.

fetcher is required; everything else tunes URL construction and per-request auth. Consumers typically set protocol once per mount (e.g. separate /net/http and /net/https mounts, as pkgManager does) and supply a shared fetcher that may be the global fetch or a wrapped proxy for browser-side CORS scenarios.

httpFS

fetcher: (url, init?) => Promise<Response>

Defined in: packages/core/src/kernel/fileservers/http.ts:42

Fetch implementation called by open() and stat() to materialize remote content. Must resolve with a Response whose .ok === true on success; non-ok responses surface as ENOENT to the caller. For browser sandboxes without global fetch, pass a bound polyfill.

string

RequestInit

Promise<Response>


optional getAuthHeader?: (pid, domain) => string | null

Defined in: packages/core/src/kernel/fileservers/http.ts:59

Factotum hook called on open() (not stat()) to synthesize an Authorization header. Returns the header value verbatim (e.g. "Bearer <token>") or null to proceed unauthenticated. Invoked with the caller’s PID and the first inner-path segment as domain. Called only when the hook is supplied and the kernel passed a pid through open().

Pid

string

string | null


optional protocol?: "http" | "https"

Defined in: packages/core/src/kernel/fileservers/http.ts:50

URL scheme used when converting inner paths to absolute URLs. Inner paths carry host+path only (e.g. example.com/api/foo); this setting picks between https://example.com/api/foo and the http:// variant. Default: 'https'. Typical deployments mount two instances — one per protocol — at sibling paths.