strong-tie/inbound-calls
0
1// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>2// Leon Yu <https://github.com/leonyu>3// BendingBender <https://github.com/BendingBender>4// Maple Miao <https://github.com/mapleeit>5 6/// <reference types="node" />7import * as stream from 'stream';8import * as http from 'http';9 10export = FormData;11 12// Extracted because @types/node doesn't export interfaces.13interface ReadableOptions {14 highWaterMark?: number;15 encoding?: string;16 objectMode?: boolean;17 read?(this: stream.Readable, size: number): void;18 destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void;19 autoDestroy?: boolean;20}21 22interface Options extends ReadableOptions {23 writable?: boolean;24 readable?: boolean;25 dataSize?: number;26 maxDataSize?: number;27 pauseStreams?: boolean;28}29 30declare class FormData extends stream.Readable {31 constructor(options?: Options);32 append(key: string, value: any, options?: FormData.AppendOptions | string): void;33 getHeaders(userHeaders?: FormData.Headers): FormData.Headers;34 submit(35 params: string | FormData.SubmitOptions,36 callback?: (error: Error | null, response: http.IncomingMessage) => void37 ): http.ClientRequest;38 getBuffer(): Buffer;39 setBoundary(boundary: string): void;40 getBoundary(): string;41 getLength(callback: (err: Error | null, length: number) => void): void;42 getLengthSync(): number;43 hasKnownLength(): boolean;44}45 46declare namespace FormData {47 interface Headers {48 [key: string]: any;49 }50 51 interface AppendOptions {52 header?: string | Headers;53 knownLength?: number;54 filename?: string;55 filepath?: string;56 contentType?: string;57 }58 59 interface SubmitOptions extends http.RequestOptions {60 protocol?: 'https:' | 'http:';61 }62}63 