Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

std/http/file_server.ts>serveFile

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function serveFile
import { serveFile } from "https://deno.land/std@0.190.0/http/file_server.ts";

Returns an HTTP Response with the requested file as the body.

Parameters

req: Request

The server request context used to cleanup the file handle.

filePath: string

Path of the file to serve.

optional
unnamed 2: ServeFileOptions = [UNSUPPORTED]