UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

26 lines (25 loc) 1.17 kB
/// <reference types="node" /> /// <reference types="node" /> import ValueCollection from "../../../classes/ValueCollection"; import { CompressionAlgorithm, type Method } from "../../global"; import { WebsocketData } from "../handle"; import { Readable } from "stream"; export declare abstract class HttpContext { private compression; abstract aborted(): AbortSignal; abstract type(): 'http' | 'ws'; abstract method(): Method; abstract path(): string; abstract clientIP(): string; abstract clientPort(): number; abstract getHeaders(): ValueCollection<string, string>; abstract onBodyChunk(callback: (chunk: ArrayBuffer, isLast: boolean) => Promise<any>): Promise<void>; compress(algorithm: CompressionAlgorithm | null): this; getCompression(): CompressionAlgorithm | null; compressionHeader(chunked: boolean): this; abstract status(code: number, message: string): this; abstract header(key: string, value: string): this; abstract write(data: ArrayBuffer | Readable): Promise<void>; abstract writeFile(file: string, start?: number, end?: number): void; abstract upgrade(data: WebsocketData): boolean; }