Add type definition for express-formidable

This commit is contained in:
Torkild Dyvik Olsen
2016-11-15 15:19:29 +01:00
parent 33ae2bd878
commit fed6ac3045
3 changed files with 58 additions and 0 deletions
@@ -0,0 +1,16 @@
import express = require("express");
import expform = require("express-formidable");
const app = express();
app.use("/form1", expform());
app.use("/form2", expform({
encoding: "utf-8",
uploadDir: "./uploads",
keepExtensions: true,
type: "multipart",
maxFieldsSize: 3 * 1024 * 1024,
maxFields: 50,
hash: "sha1",
multiples: true
}));
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for express-formidable
// Project: https://github.com/noraesae/express-formidable
// Definitions by: Torkild Dyvik Olsen <https://github.com/tdolsen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "express-formidable" {
import { RequestHandler } from "express";
interface ExpressFormidableOptions {
encoding?: string;
uploadDir?: string;
keepExtensions?: boolean;
type?: "multipart" | "urlencoded";
maxFieldsSize?: number;
maxFields?: number;
hash?: boolean | "sha1" | "md5";
multiples?: boolean;
}
function ExpressFormidable(options?: ExpressFormidableOptions): RequestHandler;
export = ExpressFormidable;
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-formidable-tests.ts"
]
}