serveFile
import { serveFile } from "jsr:@ende/http";function
async function serveFile(req: Request, filePath: string, options?: ServeFileOptions): Promise<Response>Resolves a Response with the requested file as the body.
req: RequestThe server request context used to cleanup the file handle.
filePath: stringPath of the file to serve.
options?: ServeFileOptionsAdditional options.
Returns
A response for the request.
Example: Usage
import { serveFile } from "@ende/http/file-server";
Ende.serve((req) => {
return serveFile(req, "README.md");
});