123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import { Readable } from 'stream';
-
- declare namespace getRawBody {
- export type Encoding = string | true;
-
- export interface Options {
-
-
- length?: number | string | null;
-
-
- limit?: number | string | null;
-
-
- encoding?: Encoding | null;
- }
-
- export interface RawBodyError extends Error {
-
-
- limit?: number;
-
-
- length?: number;
- expected?: number;
-
-
- received?: number;
-
-
- encoding?: string;
-
-
- status: number;
- statusCode: number;
-
-
- type: string;
- }
- }
-
-
- declare function getRawBody(
- stream: Readable,
- callback: (err: getRawBody.RawBodyError, body: Buffer) => void
- ): void;
-
- declare function getRawBody(
- stream: Readable,
- options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding,
- callback: (err: getRawBody.RawBodyError, body: string) => void
- ): void;
-
- declare function getRawBody(
- stream: Readable,
- options: getRawBody.Options,
- callback: (err: getRawBody.RawBodyError, body: Buffer) => void
- ): void;
-
- declare function getRawBody(
- stream: Readable,
- options: (getRawBody.Options & { encoding: getRawBody.Encoding }) | getRawBody.Encoding
- ): Promise<string>;
-
- declare function getRawBody(
- stream: Readable,
- options?: getRawBody.Options
- ): Promise<Buffer>;
-
- export = getRawBody;
|