forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
formidable.d.ts
56 lines (46 loc) · 1.25 KB
/
formidable.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Type definitions for Formidable 1.0.16
// Project: https://github.com/felixge/node-formidable/
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "formidable" {
import http = require("http");
import stream = require("stream");
import events = require("events");
export class IncomingForm extends events.EventEmitter {
encoding: string;
uploadDir: string;
keepExtensions: boolean;
maxFieldsSize: number;
maxFields: number;
hash: string | boolean;
multiples: boolean;
type: string;
bytesReceived: number;
bytesExpected: number;
onPart: (part: Part) => void;
handlePart(part: Part): void;
parse(req: http.IncomingMessage, callback?: (err: any, fields: Fields, files: Files) => any): void;
}
export interface Fields {
[key: string]: string;
}
export interface Files {
[key: string]: File; // | File[];
}
export interface Part extends stream.Stream {
headers: { [key: string]: string };
name: string;
filename?: string;
mime?: string;
}
export interface File {
size: number;
path: string;
name: string;
type: string;
lastModifiedDate?: Date;
hash?: string;
toJSON(): Object;
}
}