Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "utils/send"

Index

Variables

Private Const BYTES_RANGE_REGEXP

BYTES_RANGE_REGEXP: RegExp = /^ *bytes=/

Regular expression for identifying a bytes Range header.

Const ENAMETOOLONG_REGEXP

ENAMETOOLONG_REGEXP: RegExp = /\(os error 63\)$/

Const ENOENT_REGEXP

ENOENT_REGEXP: RegExp = /\(os error 2\)$/

Private Const MAX_MAXAGE

MAX_MAXAGE: number = 60 * 60 * 24 * 365 * 1000

Maximum value allowed for the max age.

Private Const UP_PATH_REGEXP

UP_PATH_REGEXP: RegExp = /(?:^|[\\/])\.\.(?:[\\/]|$)/

Regular expression to match a path with a directory up component.

Functions

_send

  • _send(req: Request, res: Response, path: string, options: any, stat: Deno.FileInfo): Promise<any>

Private clearHeaders

Private collapseLeadingSlashes

  • collapseLeadingSlashes(str: string): string

Private containsDotFile

  • containsDotFile(parts: string[]): boolean

Private contentRange

  • contentRange(type: string, size: number, range?: any): string

Private create404Error

  • create404Error(): Error

Private decode

  • decode(path: string): string | -1

Private hasTrailingSlash

  • hasTrailingSlash(path: string): boolean

Private isCachable

  • isCachable(statusCode: number): boolean

Private isConditionalGET

  • isConditionalGET(req: Request): boolean

Private isPreconditionFailure

Private isRangeFresh

Private normalizeList

  • normalizeList(value: false | string | string[], name: string): string[]

Private offsetFileReader

  • offsetFileReader(file: Deno.File, offset: number, contentLength: number): Promise<Deno.Reader>
  • Sets the read offset of the provided file and returns a Deno.Reader to read the file from the offset until the provided contentLength;

    Parameters

    • file: Deno.File
    • offset: number
    • contentLength: number

    Returns Promise<Deno.Reader>

    reader

Private removeContentHeaderFields

  • removeContentHeaderFields(res: Response): void

send

  • send<T>(req: Request, res: T, path: string, options: any): Promise<T | void>

Private sendError

  • sendError(res: Response, error?: any): void

sendExtension

  • sendExtension(req: Request, res: Response, path: string, options: any): Promise<any>

sendFile

  • sendFile(req: Request, res: Response, path: string, options: any): Promise<any>

sendIndex

  • sendIndex(req: Request, res: Response, path: string, options: any, index: string[]): Promise<any>

Generated using TypeDoc