Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
SvelteKitReference

$app/server

import{functiongetRequestEvent():RequestEvent<Partial<Record<string,string>>,string|null>

Returns the currentRequestEvent. Can be used insidehandle,load and actions (and functions called by them).

In environments withoutAsyncLocalStorage, this must be called synchronously (i.e. not after anawait).

@since2.20.0
getRequestEvent
,functionread(asset:string):Response

Read the contents of an imported asset from the filesystem

@examplejs import { read } from '$app/server'; import somefile from './somefile.txt'; const asset = read(somefile); const text = await asset.text();
@since2.4.0
read
}from'$app/server';

getRequestEvent

Available since 2.20.0

Returns the currentRequestEvent. Can be used insidehandle,load and actions (and functions called by them).

In environments withoutAsyncLocalStorage, this must be called synchronously (i.e. not after anawait).

functiongetRequestEvent():RequestEvent<Partial<Record<string,string>>,string|null>;

read

Available since 2.4.0

Read the contents of an imported asset from the filesystem

import{functionread(asset:string):Response

Read the contents of an imported asset from the filesystem

@examplejs import { read } from '$app/server'; import somefile from './somefile.txt'; const asset = read(somefile); const text = await asset.text();
@since2.4.0
read
}from'$app/server';
importconstsomefile:stringsomefilefrom'./somefile.txt';constconstasset:Responseasset=functionread(asset:string):Response

Read the contents of an imported asset from the filesystem

@examplejs import { read } from '$app/server'; import somefile from './somefile.txt'; const asset = read(somefile); const text = await asset.text();
@since2.4.0
read
(constsomefile:stringsomefile);
constconsttext:stringtext=awaitconstasset:Responseasset.Body.text():Promise<string>text();
functionread(asset:string):Response;

Edit this page on GitHub


[8]ページ先頭

©2009-2025 Movatter.jp