Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:form-data/form-data into custom-s…
…tream
- Loading branch information
Showing
13 changed files
with
411 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules/* | ||
index.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
sftp-config.json | ||
yarn.lock | ||
package-lock.json | ||
|
||
coverage/ | ||
node_modules/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz> | ||
// Leon Yu <https://github.com/leonyu> | ||
// BendingBender <https://github.com/BendingBender> | ||
// Maple Miao <https://github.com/mapleeit> | ||
|
||
/// <reference types="node" /> | ||
import * as stream from 'stream'; | ||
import * as http from 'http'; | ||
|
||
export = FormData; | ||
|
||
// Extracted because @types/node doesn't export interfaces. | ||
interface ReadableOptions { | ||
highWaterMark?: number; | ||
encoding?: string; | ||
objectMode?: boolean; | ||
read?(this: stream.Readable, size: number): void; | ||
destroy?(this: stream.Readable, error: Error | null, callback: (error: Error | null) => void): void; | ||
autoDestroy?: boolean; | ||
} | ||
|
||
interface Options extends ReadableOptions { | ||
writable?: boolean; | ||
readable?: boolean; | ||
dataSize?: number; | ||
maxDataSize?: number; | ||
pauseStreams?: boolean; | ||
} | ||
|
||
declare class FormData extends stream.Readable { | ||
constructor(options?: Options); | ||
append(key: string, value: any, options?: FormData.AppendOptions | string): void; | ||
getHeaders(userHeaders?: FormData.Headers): FormData.Headers; | ||
submit( | ||
params: string | FormData.SubmitOptions, | ||
callback?: (error: Error | null, response: http.IncomingMessage) => void | ||
): http.ClientRequest; | ||
getBuffer(): Buffer; | ||
setBoundary(boundary: string): void; | ||
getBoundary(): string; | ||
getLength(callback: (err: Error | null, length: number) => void): void; | ||
getLengthSync(): number; | ||
hasKnownLength(): boolean; | ||
} | ||
|
||
declare namespace FormData { | ||
interface Headers { | ||
[key: string]: any; | ||
} | ||
|
||
interface AppendOptions { | ||
header?: string | Headers; | ||
knownLength?: number; | ||
filename?: string; | ||
filepath?: string; | ||
contentType?: string; | ||
} | ||
|
||
interface SubmitOptions extends http.RequestOptions { | ||
protocol?: 'https:' | 'http:'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.