Skip to content

Variable: Result ​

const Result: object

Build the results an action returns to describe its output beyond its data.

Type Declaration ​

events ​

events: (producer) => EventsResult

Build an event stream result (Server-Sent Events for HTTP).

Parameters ​

producer ​

EventsProducer

Produces the events, after the action returned.

Returns ​

EventsResult

The EventsResult.

file ​

file: (source, options?) => FileResult

Build a file result.

Parameters ​

source ​

string | Buffer | Readable

The file's path (resolved from the working directory), its content, or a stream of its content.

options? ​

FileResultOptions

How the file is sent.

Returns ​

FileResult

The FileResult.

status ​

status: (status, data?, headers?) => StatusResult

Build a result with a status and headers.

Parameters ​

status ​

number

The HTTP status.

data? ​

unknown

The data sent.

headers? ​

Record<string, string>

The response headers.

Returns ​

StatusResult

The StatusResult.

Released under the MIT License.