Skip to main content
Module

x/drash/src/http/response.ts>DrashResponse#file

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method DrashResponse.prototype.file
import { DrashResponse } from "https://deno.land/x/drash@v2.7.0/src/http/response.ts";

Set the body of this response as the contents of the given filepath. The Content-Type header will be set automatically based on the extension of the filepath.

Parameters

filepath: string
  • The filepath of the file to download, relative to the CWD that executed the entrypoint script.
optional
status: number
  • The status to respond with. Default on the response is 200.
optional
headers: Record<string, string> = [UNSUPPORTED]
  • Any extra headers you wish to specify apart of the content-type header