@types/multer
Advanced tools
Comparing version 0.0.34 to 1.3.0
@@ -1,7 +0,10 @@ | ||
// Type definitions for multer | ||
// Type definitions for multer 1.3 | ||
// Project: https://github.com/expressjs/multer | ||
// Definitions by: jt000 <https://github.com/jt000>, vilicvane <https://vilic.github.io/>, David Broder-Rodgers <https://github.com/DavidBR-SW> | ||
// Definitions by: jt000 <https://github.com/jt000> | ||
// vilicvane <https://vilic.github.io/> | ||
// David Broder-Rodgers <https://github.com/DavidBR-SW> | ||
// Michael Ledin <https://github.com/mxl> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
import express = require('express'); | ||
import * as express from 'express'; | ||
@@ -21,3 +24,5 @@ declare namespace multer { | ||
storage?: StorageEngine; | ||
/** An object specifying the size limits of the following optional properties. This object is passed to busboy directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods */ | ||
/** An object specifying the size limits of the following optional properties. This object is passed to busboy | ||
* directly, and the details of properties can be found on https://github.com/mscdex/busboy#busboy-methods | ||
*/ | ||
limits?: { | ||
@@ -38,5 +43,8 @@ /** Max field name size (Default: 100 bytes) */ | ||
headerPairs?: number; | ||
/** Keep the full path of files instead of just the base name (Default: false) */ | ||
preservePath?: boolean; | ||
}; | ||
/** A function to control which files to upload and which to skip. */ | ||
fileFilter?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void) => void; | ||
fileFilter?(req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void): void; | ||
} | ||
@@ -53,3 +61,3 @@ | ||
/** A function used to determine what the file should be named inside the folder. Defaults to a random name with no file extension. */ | ||
filename?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error | null, filename: string) => void) => void; | ||
filename?(req: Express.Request, file: Express.Multer.File, callback: (error: Error | null, filename: string) => void): void; | ||
} | ||
@@ -59,12 +67,9 @@ | ||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ | ||
single(): express.RequestHandler; | ||
/** Accept a single file with the name fieldname. The single file will be stored in req.file. */ | ||
single(fieldame: string): express.RequestHandler; | ||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ | ||
array(): express.RequestHandler; | ||
/** Accept an array of files, all with the name fieldname. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ | ||
array(fieldame: string, maxCount?: number): express.RequestHandler; | ||
/** Accept a single file with the name fieldName. The single file will be stored in req.file. */ | ||
single(fieldName?: string): express.RequestHandler; | ||
/** Accept an array of files, all with the name fieldName. Optionally error out if more than maxCount files are uploaded. The array of files will be stored in req.files. */ | ||
array(fieldName: string, maxCount?: number): express.RequestHandler; | ||
/** Accept a mix of files, specified by fields. An object with arrays of files will be stored in req.files. */ | ||
fields(fields: Field[]): express.RequestHandler; | ||
/** In case you need to handle a text-only multipart form, you can use any of the multer methods (.single(), .array(), fields()), req.body contains the text fields */ | ||
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ | ||
any(): express.RequestHandler; | ||
@@ -75,3 +80,2 @@ } | ||
interface Multer { | ||
(options?: multer.Options): multer.Instance; | ||
@@ -85,3 +89,3 @@ | ||
declare var multer: Multer; | ||
declare const multer: Multer; | ||
@@ -92,11 +96,11 @@ export = multer; | ||
namespace Express { | ||
export interface Request { | ||
interface Request { | ||
file: Multer.File; | ||
files: { | ||
[fieldname: string]: Multer.File[]; | ||
}; | ||
} | Multer.File[]; | ||
} | ||
namespace Multer { | ||
export interface File { | ||
interface File { | ||
/** Field name specified in the form */ | ||
@@ -103,0 +107,0 @@ fieldname: string; |
{ | ||
"name": "@types/multer", | ||
"version": "0.0.34", | ||
"version": "1.3.0", | ||
"description": "TypeScript definitions for multer", | ||
@@ -18,2 +18,6 @@ "license": "MIT", | ||
"url": "https://github.com/DavidBR-SW" | ||
}, | ||
{ | ||
"name": "Michael Ledin", | ||
"url": "https://github.com/mxl" | ||
} | ||
@@ -31,4 +35,4 @@ ], | ||
"peerDependencies": {}, | ||
"typesPublisherContentHash": "742c956c1f3bf5eeedf92ed2b7a1eab95b79da62fda40b6a6276c87f06722950", | ||
"typesPublisherContentHash": "51017f3555912a9f47a93c76bf7260a3081153eade677ee86f623a26514437a5", | ||
"typeScriptVersion": "2.0" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Fri, 02 Jun 2017 13:55:42 GMT | ||
* Last updated: Mon, 12 Jun 2017 22:12:18 GMT | ||
* Dependencies: express | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by jt000 <https://github.com/jt000>, vilicvane <https://vilic.github.io/>, David Broder-Rodgers <https://github.com/DavidBR-SW>. | ||
These definitions were written by jt000 <https://github.com/jt000>, vilicvane <https://vilic.github.io/>, David Broder-Rodgers <https://github.com/DavidBR-SW>, Michael Ledin <https://github.com/mxl>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
107
1
8438