exportFS
exportFS(
server,channel):ExportHandle
Defined in: packages/runtime/src/container/proxy.ts:199
Expose a local Fileserver over a Channel.
Parameters
Section titled “Parameters”server
Section titled “server”Local fileserver to proxy.
channel
Section titled “channel”Channel the client side will importFS() from.
Returns
Section titled “Returns”An ExportHandle — call dispose() to tear down.
Remarks
Section titled “Remarks”The server-side proxy maintains an fd map translating integer proxy fds (issued
monotonically as opens succeed) to the opaque server-side fd tokens. Reads
transfer the result ArrayBuffer for zero-copy where the channel supports it.
Errors are serialized as {ok: false, code, message} — plain objects cross the
channel, FsError is reconstructed on the client side by importFS.
Example
Section titled “Example”import { exportFS, importFS, createMemoryChannel } from '@fishnet/runtime/container/proxy'import { memoryFS } from '@fishnet/core'
const [srvCh, cliCh] = createMemoryChannel()const handle = exportFS(memoryFS(), srvCh) // server sideconst proxy = importFS(cliCh) // client side// ... use proxy as a Fileserver ...proxy.disconnect()handle.dispose()