API reference
files-read-codec
Import
Section titled “Import”import * as api from "@fungi.computer/knapsack/files-read-codec";Exports
Section titled “Exports”| 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”type FilesReadTransport = (frame, context) => Promise<string>;Host transport carrying a framed Files read with its invocation context.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
frame |
string |
context |
InvocationContext |
Returns
Section titled “Returns”Promise<string>
encodeFilesReadRequest()function
Section titled “encodeFilesReadRequest()”function encodeFilesReadRequest(input): string;Validate and encode a bounded Files read request as a JSON frame.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
{ path: string; offset?: number; limit?: number; } |
input.path |
string |
input.offset? |
number |
input.limit? |
number |
Returns
Section titled “Returns”string
createFilesReadAdapter()function
Section titled “createFilesReadAdapter()”function createFilesReadAdapter(transport): Pick<FilesPort, "read">;Adapt a framed transport to the Files read port; Knapsack.files owns the
operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
transport |
FilesReadTransport |
Returns
Section titled “Returns”Pick<FilesPort, "read">