Skip to content
API reference

files-read-codec

Import
import * as api from "@fungi.computer/knapsack/files-read-codec";
Kind Export Description
type alias FilesReadTransport Host transport carrying a framed Files read with its invocation context.
function encodeFilesReadRequest() Validate and encode a bounded Files read request as a JSON frame.
function createFilesReadAdapter() Adapt a framed transport to the Files read port; Knapsack.files owns the operation.

FilesReadTransporttype alias

Section titled “FilesReadTransport”
Signature
type FilesReadTransport = (frame, context) => Promise<string>;

Host transport carrying a framed Files read with its invocation context.

Parameter Type
frame string
context InvocationContext

Promise<string>

encodeFilesReadRequest()function

Section titled “encodeFilesReadRequest()”
Signature
function encodeFilesReadRequest(input): string;

Validate and encode a bounded Files read request as a JSON frame.

Parameter Type
input { path: string; offset?: number; limit?: number; }
input.path string
input.offset? number
input.limit? number

string


createFilesReadAdapter()function

Section titled “createFilesReadAdapter()”
Signature
function createFilesReadAdapter(transport): Pick<FilesPort, "read">;

Adapt a framed transport to the Files read port; Knapsack.files owns the operation.

Parameter Type
transport FilesReadTransport

Pick<FilesPort, "read">