importFS
importFS(
channel):Fileserver&object
Defined in: packages/runtime/src/container/proxy.ts:345
Create a local Fileserver backed by a remote exportFS over a Channel.
Parameters
Section titled “Parameters”channel
Section titled “channel”Channel the remote exportFS is listening on.
Returns
Section titled “Returns”Fileserver & object
A fileserver (+ disconnect()) whose methods proxy as request/response messages.
Remarks
Section titled “Remarks”All ten Fileserver methods are proxied. Errors are reconstructed as
FsError from the response code / message, so callers see the same
shape as a local server. disconnect() rejects all pending calls with
EPIPE and fails future calls the same way — idempotent.
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)const proxy = importFS(cliCh)await proxy.mkdir('/tmp' as InnerPath)proxy.disconnect()handle.dispose()