Skip to main content
Module

x/oak/deps.ts

A middleware framework for handling HTTP with Deno 🐿️ 🦕
Extremely Popular
Go to Latest
import * as oak from "https://deno.land/x/oak@v12.0.0/deps.ts";

Namespaces

encode and decode for base64 encoding.

Classes

The base class that all derivative HTTP extend, providing a status and an expose property.

Enums

Standard HTTP status codes.

Variables

A namespace that contains each error constructor. Each error extends HTTPError and provides .status and .expose properties, where the .status will be an error Status value and .expose indicates if information, like a stack trace, should be shared in the response.

A record of all the status codes text.

Functions

Returns an array of media types accepted by the request, in order of preference. If there are no media types supplied in the request, then any media type selector will be returned.

Returns an array of content encodings accepted by the request, in order of preference. If there are no encoding supplied in the request, then ["*"] is returned, implying any encoding is accepted.

Returns an array of languages accepted by the request, in order of preference. If there are no languages supplied in the request, then ["*"] is returned, imply any language is accepted.

Decodes a given RFC4648 base64 encoded string

CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation

Compile a string to a template function for the path.

Concatenate the given arrays into a new Uint8Array.

Given an extension or media type, return a full Content-Type or Content-Disposition header value.

Copy bytes from the src array to the dst array. Returns the number of bytes copied.

A factory function which provides a way to create errors. It takes up to 3 arguments, the error Status, an message, which defaults to the status text and error options, which incudes the expose property to set the .expose value on the error.

Creates a Promise with the reject and resolve functions placed as methods on the promise object itself.

Check whether binary arrays are equal to each other.

For a given media type, return the most relevant extension, or undefined if no extension can be found.

A type guard that determines if the value is an HttpError or not.

Create path match function from path-to-regexp spec.

Parse a string for the raw tokens.

Normalize the given path string, returning a regular expression.

Read Reader r until EOF (null) and resolve to the content as Uint8Array`.

Create a Reader from a ReadableStreamDefaultReader.

Compare to array buffers or data views in a way that timing based attacks cannot gain information about the platform.

Returns the media type associated with the file extension. Values are normalized to lower case and matched irrespective of a leading ..

Write all the content of the array buffer (arr) to the writer (w).