httpFS
httpFS(
opts):Fileserver
Defined in: packages/core/src/kernel/fileservers/http.ts:198
Create a read-through HTTP fileserver that maps inner paths to URLs.
Parameters
Section titled “Parameters”Fetcher, optional protocol override, and optional auth hook; see HttpFSOpts.
Returns
Section titled “Returns”A read-only Fileserver that fetches bodies on demand.
Remarks
Section titled “Remarks”Mount at a path like /net/https or /net/http. The inner path following
the mount point is treated as <host>/<path> and resolved against
HttpFSOpts.protocol; open() issues a GET via HttpFSOpts.fetcher
and buffers the full body in memory, which is then served to subsequent
read() calls. stat() issues a HEAD-shaped GET and cancels the body
stream once content-length is observed.
The fileserver is strictly read-only: write, mkdir, remove, rename,
wstat, and open() with write/create/truncate flags all throw EPERM.
readdir throws EPERM — HTTP does not expose directory enumeration.
Permission checks are short-circuited via checkAccess() — mode bits on a
remote URL are meaningless, so enforcement is delegated to the HTTP layer
(status codes + optional auth header).
Example
Section titled “Example”import { httpFS, Unix } from '@fishnet/core'const net = httpFS({ fetcher: globalThis.fetch.bind(globalThis), protocol: 'https' })const sys = await Unix().mount('/net/https', net).build().boot()await sys.run('cat /net/https/example.com/index.html')Caveat
Section titled “Caveat”open() buffers the entire response body at once; a multi-GB
response will allocate a multi-GB Uint8Array. Pair with
readonlyFS only if you want the mount flag form — this server
is already read-only at the protocol level.