@types/multer
Advanced tools
Comparing version 0.0.21-alpha to 0.0.22-alpha
148
index.d.ts
@@ -6,4 +6,76 @@ // Type definitions for multer | ||
import express = require('express'); | ||
declare namespace multer { | ||
interface Field { | ||
/** The field name. */ | ||
name: string; | ||
/** Optional maximum number of files per field to accept. */ | ||
maxCount?: number; | ||
} | ||
interface Options { | ||
/** The destination directory for the uploaded files. */ | ||
dest?: string; | ||
/** The storage engine to use for uploaded files. */ | ||
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 */ | ||
limits?: { | ||
/** Max field name size (Default: 100 bytes) */ | ||
fieldNameSize?: number; | ||
/** Max field value size (Default: 1MB) */ | ||
fieldSize?: number; | ||
/** Max number of non- file fields (Default: Infinity) */ | ||
fields?: number; | ||
/** For multipart forms, the max file size (in bytes)(Default: Infinity) */ | ||
fileSize?: number; | ||
/** For multipart forms, the max number of file fields (Default: Infinity) */ | ||
files?: number; | ||
/** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ | ||
parts?: number; | ||
/** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ | ||
headerPairs?: number; | ||
}; | ||
/** 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; | ||
} | ||
interface StorageEngine { | ||
_handleFile(req: express.Request, file: Express.Multer.File, callback: (error?: any, info?: Express.Multer.File) => void): void; | ||
_removeFile(req: express.Request, file: Express.Multer.File, callback: (error: Error) => void): void; | ||
} | ||
interface DiskStorageOptions { | ||
/** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ | ||
destination?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, destination: string) => void) => void; | ||
/** 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, filename: string) => void) => void; | ||
} | ||
interface Instance { | ||
/** Accept a single file with the name fieldname. The single file will be stored in req.file. */ | ||
single(fieldame: 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(fieldame: 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; | ||
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ | ||
any(): express.RequestHandler; | ||
} | ||
} | ||
interface Multer { | ||
(options?: multer.Options): multer.Instance; | ||
/* The disk storage engine gives you full control on storing files to disk. */ | ||
diskStorage(options: multer.DiskStorageOptions): multer.StorageEngine; | ||
/* The memory storage engine stores the files in memory as Buffer objects. */ | ||
memoryStorage(): multer.StorageEngine; | ||
} | ||
declare var multer: Multer; | ||
export = multer; | ||
declare namespace Express { | ||
@@ -40,77 +112,1 @@ export interface Request { | ||
} | ||
declare module "multer" { | ||
import express = require('express'); | ||
namespace multer { | ||
interface Field { | ||
/** The field name. */ | ||
name: string; | ||
/** Optional maximum number of files per field to accept. */ | ||
maxCount?: number; | ||
} | ||
interface Options { | ||
/** The destination directory for the uploaded files. */ | ||
dest?: string; | ||
/** The storage engine to use for uploaded files. */ | ||
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 */ | ||
limits?: { | ||
/** Max field name size (Default: 100 bytes) */ | ||
fieldNameSize?: number; | ||
/** Max field value size (Default: 1MB) */ | ||
fieldSize?: number; | ||
/** Max number of non- file fields (Default: Infinity) */ | ||
fields?: number; | ||
/** For multipart forms, the max file size (in bytes)(Default: Infinity) */ | ||
fileSize?: number; | ||
/** For multipart forms, the max number of file fields (Default: Infinity) */ | ||
files?: number; | ||
/** For multipart forms, the max number of parts (fields + files)(Default: Infinity) */ | ||
parts?: number; | ||
/** For multipart forms, the max number of header key=> value pairs to parse Default: 2000(same as node's http). */ | ||
headerPairs?: number; | ||
}; | ||
/** 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; | ||
} | ||
interface StorageEngine { | ||
_handleFile(req: express.Request, file: Express.Multer.File, callback: (error?: any, info?: Express.Multer.File) => void): void; | ||
_removeFile(req: express.Request, file: Express.Multer.File, callback: (error: Error) => void): void; | ||
} | ||
interface DiskStorageOptions { | ||
/** A function used to determine within which folder the uploaded files should be stored. Defaults to the system's default temporary directory. */ | ||
destination?: (req: Express.Request, file: Express.Multer.File, callback: (error: Error, destination: string) => void) => void; | ||
/** 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, filename: string) => void) => void; | ||
} | ||
interface Instance { | ||
/** Accept a single file with the name fieldname. The single file will be stored in req.file. */ | ||
single(fieldame: 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(fieldame: 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; | ||
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */ | ||
any(): express.RequestHandler; | ||
} | ||
} | ||
interface Multer { | ||
(options?: multer.Options): multer.Instance; | ||
/* The disk storage engine gives you full control on storing files to disk. */ | ||
diskStorage(options: multer.DiskStorageOptions): multer.StorageEngine; | ||
/* The memory storage engine stores the files in memory as Buffer objects. */ | ||
memoryStorage(): multer.StorageEngine; | ||
} | ||
var multer: Multer; | ||
export = multer; | ||
} |
{ | ||
"name": "@types/multer", | ||
"version": "0.0.21-alpha", | ||
"version": "0.0.22-alpha", | ||
"description": "TypeScript definitions for multer", | ||
@@ -8,5 +8,11 @@ "main": "", | ||
"author": "jt000 <https://github.com/jt000>, vilicvane <https://vilic.github.io/>, David Broder-Rodgers <https://github.com/DavidBR-SW>", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
}, | ||
"license": "MIT", | ||
"typings": "index.d.ts", | ||
"dependencies": {} | ||
"dependencies": { | ||
"@types/express": "4.0.*" | ||
} | ||
} |
@@ -11,9 +11,9 @@ # Installation | ||
Additional Details | ||
* Last updated: Wed, 25 May 2016 04:20:26 GMT | ||
* File structure: OldUMD | ||
* Last updated: Fri, 01 Jul 2016 18:42:29 GMT | ||
* File structure: ProperModule | ||
* Library Dependencies: none | ||
* Module Dependencies: none | ||
* Global values: none | ||
* Module Dependencies: express | ||
* Global values: multer | ||
# Credits | ||
These definitions were written by jt000 <https://github.com/jt000>, vilicvane <https://vilic.github.io/>, David Broder-Rodgers <https://github.com/DavidBR-SW>. |
@@ -5,3 +5,5 @@ { | ||
"libraryDependencies": [], | ||
"moduleDependencies": [], | ||
"moduleDependencies": [ | ||
"express" | ||
], | ||
"libraryMajorVersion": "0", | ||
@@ -14,4 +16,6 @@ "libraryMinorVersion": "0", | ||
"sourceBranch": "types-2.0", | ||
"kind": "OldUMD", | ||
"globals": [], | ||
"kind": "ProperModule", | ||
"globals": [ | ||
"multer" | ||
], | ||
"declaredModules": [ | ||
@@ -23,3 +27,3 @@ "multer" | ||
], | ||
"contentHash": "7d730232ff7eb700f3c74a501a5993a6947de57a0c0c4f002faf9ea43c83b8c8" | ||
"contentHash": "afeb67d46a74cda826dfd70780a85b8342bc6a07bf2808310999a95b7f78afcc" | ||
} |
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 repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
122
0
7113
1
+ Added@types/express@4.0.*
+ Added@types/body-parser@1.19.5(transitive)
+ Added@types/connect@3.4.38(transitive)
+ Added@types/express@4.0.39(transitive)
+ Added@types/express-serve-static-core@5.0.1(transitive)
+ Added@types/http-errors@2.0.4(transitive)
+ Added@types/mime@1.3.5(transitive)
+ Added@types/node@22.9.0(transitive)
+ Added@types/qs@6.9.17(transitive)
+ Added@types/range-parser@1.2.7(transitive)
+ Added@types/send@0.17.4(transitive)
+ Added@types/serve-static@1.15.7(transitive)
+ Addedundici-types@6.19.8(transitive)