Skip to main content

@std/http@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)

Functions

f
serveDir(
req: Request,
opts?: ServeDirOptions
): Promise<Response>

Serves the files under the given directory root (opts.fsRoot).

f
serveFile(
req: Request,
filePath: string,
unnamed 2?: ServeFileOptions
): Promise<Response>

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

Interfaces

I

Interface for serveDir options.

  • enableCors: boolean

    Enable CORS via the "Access-Control-Allow-Origin" header.

  • etagAlgorithm: AlgorithmIdentifier

    The algorithm to use for generating the ETag.

  • fsRoot: string

    Serves the files under the given directory root. Defaults to your current directory.

  • headers: string[]

    Headers to add to each response

  • quiet: boolean

    Do not print request level logs. Defaults to false.

  • Enable directory listing.

  • showDotfiles: boolean

    Serves dotfiles.

  • showIndex: boolean

    Serves index.html as the index file of the directory.

  • urlRoot: string

    Specified that part is stripped from the beginning of the requested pathname.

I

Interface for serveFile options.

  • etagAlgorithm: AlgorithmIdentifier

    The algorithm to use for generating the ETag.

  • fileInfo: Deno.FileInfo

    An optional FileInfo object returned by Deno.stat. It is used for optimization purposes.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/http

Import symbol

import * as mod from "@std/http/file_server";
or

Import directly with a jsr specifier

import * as mod from "jsr:@std/http/file_server";