Module

x/drash/mod.ts>Response#download

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method Response.prototype.download
import { Response } from "https://dotland.deno.dev/x/drash@v2.7.0/mod.ts";

Set the body of this response as a downloaded type given the filepath, filename, and content type of the downloadable type.

Examples

Example 1

response.download(
  "./images/user_1_profile_pic.png",
  "image/png"
);

Parameters

filepath: string
  • The filepath of the file to download, relative to the CWD that executed the entrypoint script.
contentType: string
  • The content type of the associated file.
optional
headers: Record<string, string> = [UNSUPPORTED]
  • Any extra headers you wish to specify apart of the content-type header