Files
SnowLuma/.pnpm-store/v11/files/81/8b41c4d24cf13ba7e2adbaae079d604004f5d4962ab0584c6e6dc28bd8eab9b528d146c8fcf94c594c1c517c1a87b6e5a4381c3b2d443a1d68a7fda093cb84
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

31 lines
1.3 KiB
Plaintext

import { Env, MiddlewareHandler } from "../../types.js";
import { Context, Data } from "../../context.js";
//#region src/middleware/serve-static/index.d.ts
export type ServeStaticOptions<E extends Env = Env> = {
root?: string;
path?: string;
precompressed?: boolean;
/** Allow percent signs in the routed request path. Defaults to false. */
allowPercentInPath?: boolean;
mimes?: Record<string, string>;
rewriteRequestPath?: (path: string) => string;
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
};
/**
* This middleware is not directly used by the user. Create a wrapper specifying `getContent()` by the environment such as Deno or Bun.
*/
export declare const serveStatic: <E extends Env = Env>(options: ServeStaticOptions<E> & {
getContent: (path: string, c: Context<E>) => Promise<Data | Response | null>;
/**
*
* `join` option according to the runtime. Example `import { join } from 'node:path`. If not specified, it will fall back to the default join function.`
*/
join?: (...paths: string[]) => string;
/**
* @deprecated Currently, `pathResolve` is no longer used.
*/
pathResolve?: (path: string) => string;
isDir?: (path: string) => boolean | undefined | Promise<boolean | undefined>;
}) => MiddlewareHandler;
//#endregion