$app/server
import { function getRequestEvent(): RequestEvent<Partial<Record<string, string>>, string | null>Returns the current RequestEvent. Can be used inside handle, load and actions (and functions called by them).
In environments without AsyncLocalStorage, this must be called synchronously (i.e. not after an await).
getRequestEvent, function read(asset: string): ResponseRead the contents of an imported asset from the filesystem
read } from '$app/server';getRequestEvent
Available since 2.20.0
Returns the current RequestEvent. Can be used inside server hooks, server load functions, actions, and endpoints (and functions called by them).
In environments without AsyncLocalStorage, this must be called synchronously (i.e. not after an await).
function getRequestEvent(): RequestEvent<
Partial<Record<string, string>>,
string | null
>;read
Available since 2.4.0
Read the contents of an imported asset from the filesystem
import { function read(asset: string): ResponseRead the contents of an imported asset from the filesystem
read } from '$app/server';
import const somefile: stringsomefile from './somefile.txt';
const const asset: Responseasset = function read(asset: string): ResponseRead the contents of an imported asset from the filesystem
read(const somefile: stringsomefile);
const const text: stringtext = await const asset: Responseasset.Body.text(): Promise<string>text();function read(asset: string): Response;Edit this page on GitHub llms.txt