fix: fastify-multipart not needed

This commit is contained in:
Jannik Keye
2019-02-11 08:17:56 +01:00
parent 363cdf403a
commit 0bb3dd43aa
6 changed files with 6 additions and 120 deletions
+6
View File
@@ -576,6 +576,12 @@
"sourceRepoURL": "https://github.com/fastify/fastify-jwt",
"asOfVersion": "0.8.1"
},
{
"libraryName": "fastify-multipart",
"typingsPackageName": "fastify-multipart",
"sourceRepoURL": "https://github.com/fastify/fastify-multipart",
"asOfVersion": "0.7.0"
},
{
"libraryName": "fastify-static",
"typingsPackageName": "fastify-static",
@@ -1,24 +0,0 @@
import fastify = require("fastify");
import fastifyMultipart = require("fastify-multipart");
const app = fastify();
app.register<fastifyMultipart.FastifyMultipartOptions>(fastifyMultipart, {
limits: {
fieldNameSize: 200,
fieldSize: 200,
fields: 200,
fileSize: 200,
files: 2,
headerPairs: 200,
}
});
app.get("/path", (request) => {
const isMultiPart = request.isMultipart();
request.multipart((field, file, filename, encoding, mimetype) => {
console.log(field, file, filename, encoding, mimetype);
}, (err) => {
throw err;
});
});
-66
View File
@@ -1,66 +0,0 @@
// Type definitions for fastify-multipart 0.5
// Project: https://github.com/fastify/fastify-multipart#readme
// Definitions by: Jannik Keye <https://github.com/jannikkeye>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
import busboy = require("busboy");
import fastify = require("fastify");
import { IncomingMessage, ServerResponse } from 'http';
declare module "fastify" {
interface FastifyRequest<HttpRequest> {
isMultipart: () => boolean;
multipart: (handler: fastifyMultipart.MultipartHandler, next: (err: Error) => void) => busboy.Busboy;
}
}
declare function fastifyMultipart(): void;
declare namespace fastifyMultipart {
type MultipartHandler = (
field: string,
file: any,
filename: string,
encoding: string,
mimetype: string,
) => void;
interface FastifyMultipartOptions {
limits?: {
/**
* Max field name size in bytes
*/
fieldNameSize?: number;
/**
* Max field value size in bytes
*/
fieldSize?: number;
/**
* Max number of non-file fields
*/
fields?: number;
/**
* For multipart forms, the max file size
*/
fileSize?: number;
/**
* Max number of file fields
*/
files?: number;
/**
* Max number of header key=>value pairs
*/
headerPairs?: number;
};
}
}
export = fastifyMultipart;
-6
View File
@@ -1,6 +0,0 @@
{
"private": true,
"dependencies": {
"fastify": "^1.11.2"
}
}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"fastify-multipart-tests.ts"
]
}
-1
View File
@@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }