@nestjs/platform-fastify 11.2.6 → 11.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/interfaces/external/fastify-multipart-options.interface.d.ts +0 -53
- package/interfaces/external/fastify-multipart-options.interface.js +0 -1
- package/multipart/files.constants.d.ts +0 -1
- package/multipart/files.constants.js +0 -1
- package/multipart/index.d.ts +0 -4
- package/multipart/index.js +0 -4
- package/multipart/interceptors/any-files.interceptor.d.ts +0 -12
- package/multipart/interceptors/any-files.interceptor.js +0 -13
- package/multipart/interceptors/file-fields.interceptor.d.ts +0 -13
- package/multipart/interceptors/file-fields.interceptor.js +0 -14
- package/multipart/interceptors/file-stream.interceptor.d.ts +0 -31
- package/multipart/interceptors/file-stream.interceptor.js +0 -32
- package/multipart/interceptors/file.interceptor.d.ts +0 -17
- package/multipart/interceptors/file.interceptor.js +0 -18
- package/multipart/interceptors/files.interceptor.d.ts +0 -14
- package/multipart/interceptors/files.interceptor.js +0 -15
- package/multipart/interceptors/index.d.ts +0 -6
- package/multipart/interceptors/index.js +0 -6
- package/multipart/interceptors/no-files.interceptor.d.ts +0 -12
- package/multipart/interceptors/no-files.interceptor.js +0 -13
- package/multipart/interfaces/files-upload-module.interface.d.ts +0 -18
- package/multipart/interfaces/files-upload-module.interface.js +0 -1
- package/multipart/interfaces/index.d.ts +0 -3
- package/multipart/interfaces/index.js +0 -3
- package/multipart/interfaces/multipart-file.interface.d.ts +0 -70
- package/multipart/interfaces/multipart-file.interface.js +0 -1
- package/multipart/interfaces/multipart-options.interface.d.ts +0 -77
- package/multipart/interfaces/multipart-options.interface.js +0 -1
- package/multipart/multipart/append-field.util.d.ts +0 -6
- package/multipart/multipart/append-field.util.js +0 -112
- package/multipart/multipart/multipart-interceptor.factory.d.ts +0 -13
- package/multipart/multipart/multipart-interceptor.factory.js +0 -130
- package/multipart/multipart/multipart.constants.d.ts +0 -55
- package/multipart/multipart/multipart.constants.js +0 -74
- package/multipart/multipart/multipart.error.d.ts +0 -10
- package/multipart/multipart/multipart.error.js +0 -15
- package/multipart/multipart/multipart.parser.d.ts +0 -39
- package/multipart/multipart/multipart.parser.js +0 -369
- package/multipart/multipart/multipart.utils.d.ts +0 -28
- package/multipart/multipart/multipart.utils.js +0 -54
- package/multipart/multipart.constants.d.ts +0 -1
- package/multipart/multipart.constants.js +0 -1
- package/multipart/multipart.module.d.ts +0 -18
- package/multipart/multipart.module.js +0 -75
- package/multipart/storage/disk.storage.d.ts +0 -24
- package/multipart/storage/disk.storage.js +0 -58
- package/multipart/storage/index.d.ts +0 -2
- package/multipart/storage/index.js +0 -2
- package/multipart/storage/memory.storage.d.ts +0 -8
- package/multipart/storage/memory.storage.js +0 -23
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata, __param } from "tslib";
|
|
2
|
-
import { Inject, mixin, Optional, StreamableFile, } from '@nestjs/common';
|
|
3
|
-
import { HttpAdapterHost } from '@nestjs/core';
|
|
4
|
-
import { catchError, concatMap, from, throwError } from 'rxjs';
|
|
5
|
-
import { MULTIPART_MODULE_OPTIONS } from '../files.constants.js';
|
|
6
|
-
import { MISSING_PLUGIN_MESSAGE, PLUGIN_NOT_REGISTERED_AT_STARTUP_MESSAGE, WRONG_ADAPTER_MESSAGE, } from './multipart.constants.js';
|
|
7
|
-
import { drainRequest, processMultipart, processStream, resolveStorage, validateLimits, } from './multipart.parser.js';
|
|
8
|
-
import { mergeMultipartOptions } from './multipart.utils.js';
|
|
9
|
-
const verifiedInstances = new WeakSet();
|
|
10
|
-
/**
|
|
11
|
-
* Asks the FastifyAdapter to register the `@fastify/multipart` plugin (it
|
|
12
|
-
* skips that when the plugin is registered already, or when its
|
|
13
|
-
* `multipart` option is `false`), and fails the application's startup with
|
|
14
|
-
* an actionable message if the plugin still is not registered once every
|
|
15
|
-
* plugin has loaded. Without the plugin, Fastify answers every multipart
|
|
16
|
-
* request with a bare 415 before any interceptor runs.
|
|
17
|
-
*
|
|
18
|
-
* This runs from `onModuleInit`, before Fastify's `ready()`: the plugin
|
|
19
|
-
* registered here loads with the others, before the server starts, and
|
|
20
|
-
* the check is deferred to an `onReady` hook.
|
|
21
|
-
*/
|
|
22
|
-
function setUpHttpAdapter(adapterHost) {
|
|
23
|
-
const httpAdapter = adapterHost?.httpAdapter;
|
|
24
|
-
if (!httpAdapter) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (httpAdapter.getType() !== 'fastify') {
|
|
28
|
-
throw new Error(WRONG_ADAPTER_MESSAGE);
|
|
29
|
-
}
|
|
30
|
-
const instance = httpAdapter.getInstance();
|
|
31
|
-
if (verifiedInstances.has(instance)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const isRegistered = () => instance.hasRequestDecorator('isMultipart');
|
|
35
|
-
try {
|
|
36
|
-
httpAdapter.useMultipart?.();
|
|
37
|
-
instance.addHook('onReady', async () => {
|
|
38
|
-
if (!isRegistered()) {
|
|
39
|
-
throw new Error(MISSING_PLUGIN_MESSAGE);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
// The instance has already started (e.g. the interceptor was created
|
|
45
|
-
// by a lazy-loaded module): no plugin can be registered any more, and
|
|
46
|
-
// every plugin is loaded.
|
|
47
|
-
if (!isRegistered()) {
|
|
48
|
-
throw new Error(PLUGIN_NOT_REGISTERED_AT_STARTUP_MESSAGE);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
verifiedInstances.add(instance);
|
|
52
|
-
}
|
|
53
|
-
class MultipartInterceptorHost {
|
|
54
|
-
adapterHost;
|
|
55
|
-
options;
|
|
56
|
-
constructor(moduleOptions = {}, adapterHost, localOptions) {
|
|
57
|
-
this.adapterHost = adapterHost;
|
|
58
|
-
this.options = mergeMultipartOptions(moduleOptions, localOptions);
|
|
59
|
-
if (typeof this.options.limits !== 'function') {
|
|
60
|
-
validateLimits(this.options.limits);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
onModuleInit() {
|
|
64
|
-
setUpHttpAdapter(this.adapterHost);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Creates an interceptor that parses the multipart body with multer's
|
|
69
|
-
* semantics, as described by `spec`.
|
|
70
|
-
*/
|
|
71
|
-
export function createMultipartInterceptor(spec, localOptions) {
|
|
72
|
-
let MixinInterceptor = class MixinInterceptor extends MultipartInterceptorHost {
|
|
73
|
-
// Resolved once per interceptor, as multer does, so that a `dest`
|
|
74
|
-
// folder is created at bootstrap.
|
|
75
|
-
storage;
|
|
76
|
-
constructor(options = {}, adapterHost) {
|
|
77
|
-
super(options, adapterHost, localOptions);
|
|
78
|
-
this.storage = resolveStorage(this.options);
|
|
79
|
-
}
|
|
80
|
-
async intercept(context, next) {
|
|
81
|
-
const req = context.switchToHttp().getRequest();
|
|
82
|
-
await processMultipart(req, spec, this.options, this.storage);
|
|
83
|
-
return next.handle();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
MixinInterceptor = __decorate([
|
|
87
|
-
__param(0, Optional()),
|
|
88
|
-
__param(0, Inject(MULTIPART_MODULE_OPTIONS)),
|
|
89
|
-
__param(1, Optional()),
|
|
90
|
-
__param(1, Inject(HttpAdapterHost)),
|
|
91
|
-
__metadata("design:paramtypes", [Object, HttpAdapterHost])
|
|
92
|
-
], MixinInterceptor);
|
|
93
|
-
return mixin(MixinInterceptor);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Creates an interceptor that hands the route handler the stream of a single
|
|
97
|
-
* file in `fieldName`.
|
|
98
|
-
*/
|
|
99
|
-
export function createMultipartStreamInterceptor(fieldName, localOptions) {
|
|
100
|
-
let MixinInterceptor = class MixinInterceptor extends MultipartInterceptorHost {
|
|
101
|
-
constructor(options = {}, adapterHost) {
|
|
102
|
-
super(options, adapterHost, localOptions);
|
|
103
|
-
}
|
|
104
|
-
async intercept(context, next) {
|
|
105
|
-
const ctx = context.switchToHttp();
|
|
106
|
-
const req = ctx.getRequest();
|
|
107
|
-
const reply = ctx.getResponse();
|
|
108
|
-
await processStream(req, fieldName, this.options);
|
|
109
|
-
// Whatever the handler leaves unread is discarded before the response
|
|
110
|
-
// is sent, as multer does: responding while the client is still
|
|
111
|
-
// uploading makes Node.js close the connection under it (EPIPE /
|
|
112
|
-
// ECONNRESET on the client) when it is not kept alive, and leaves a
|
|
113
|
-
// kept-alive connection with an unread body. A StreamableFile
|
|
114
|
-
// response is the exception, as it may be the upload itself, which
|
|
115
|
-
// only drains while the response is sent; what it leaves unread is
|
|
116
|
-
// discarded once the response is out.
|
|
117
|
-
reply.raw.once('close', () => void drainRequest(req.raw));
|
|
118
|
-
const drainBefore = (result) => from(drainRequest(req.raw).then(() => result));
|
|
119
|
-
return next.handle().pipe(concatMap(result => result instanceof StreamableFile ? [result] : drainBefore(result)), catchError(err => drainBefore(undefined).pipe(concatMap(() => throwError(() => err)))));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
MixinInterceptor = __decorate([
|
|
123
|
-
__param(0, Optional()),
|
|
124
|
-
__param(0, Inject(MULTIPART_MODULE_OPTIONS)),
|
|
125
|
-
__param(1, Optional()),
|
|
126
|
-
__param(1, Inject(HttpAdapterHost)),
|
|
127
|
-
__metadata("design:paramtypes", [Object, HttpAdapterHost])
|
|
128
|
-
], MixinInterceptor);
|
|
129
|
-
return mixin(MixinInterceptor);
|
|
130
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Same codes and messages as multer's `MulterError`, copied from
|
|
3
|
-
* `@nestjs/platform-express` (`multer/multer/multer.constants.ts`) so that
|
|
4
|
-
* clients see identical error responses on both adapters without this
|
|
5
|
-
* package depending on platform-express.
|
|
6
|
-
*/
|
|
7
|
-
export declare const multerExceptions: {
|
|
8
|
-
readonly LIMIT_PART_COUNT: "Too many parts";
|
|
9
|
-
readonly LIMIT_FILE_SIZE: "File too large";
|
|
10
|
-
readonly LIMIT_FILE_COUNT: "Too many files";
|
|
11
|
-
readonly LIMIT_FIELD_KEY: "Field name too long";
|
|
12
|
-
readonly LIMIT_FIELD_VALUE: "Field value too long";
|
|
13
|
-
readonly LIMIT_FIELD_COUNT: "Too many fields";
|
|
14
|
-
readonly LIMIT_UNEXPECTED_FILE: "Unexpected file field";
|
|
15
|
-
readonly MISSING_FIELD_NAME: "Field name missing";
|
|
16
|
-
readonly LIMIT_FIELD_NESTING: "Field name nesting too deep";
|
|
17
|
-
readonly INVALID_FIELD_NAME: "Invalid field name";
|
|
18
|
-
};
|
|
19
|
-
export type MultipartErrorCode = keyof typeof multerExceptions;
|
|
20
|
-
/**
|
|
21
|
-
* The messages platform-express reports for busboy 1.x parser errors
|
|
22
|
-
* (prefixed with "Multipart: "), which is what multer bundles.
|
|
23
|
-
*/
|
|
24
|
-
export declare const busboyExceptions: {
|
|
25
|
-
readonly MULTIPART_BOUNDARY_NOT_FOUND: "Multipart: Boundary not found";
|
|
26
|
-
readonly MULTIPART_UNEXPECTED_END_OF_FORM: "Multipart: Unexpected end of form";
|
|
27
|
-
readonly MULTIPART_UNEXPECTED_END_OF_FILE: "Multipart: Unexpected end of file";
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* `@fastify/busboy` raises plain `Error`s without a `code`, so these are the
|
|
31
|
-
* only messages matched verbatim. Everything `@fastify/multipart` raises is
|
|
32
|
-
* matched by its `code` instead (see `fastifyMultipartErrorCodes`).
|
|
33
|
-
*
|
|
34
|
-
* @see https://github.com/fastify/busboy/blob/main/deps/dicer/lib/Dicer.js
|
|
35
|
-
*/
|
|
36
|
-
export declare const fastifyBusboyMessages: {
|
|
37
|
-
readonly BOUNDARY_NOT_FOUND: "Multipart: Boundary not found";
|
|
38
|
-
readonly UNEXPECTED_END_OF_FORM: "Unexpected end of multipart data";
|
|
39
|
-
readonly PART_TERMINATED_EARLY: "terminated early due to unexpected end";
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* `@fastify/multipart` error codes (created with `@fastify/error`) mapped to
|
|
43
|
-
* the multer code that describes the same condition.
|
|
44
|
-
*
|
|
45
|
-
* @see https://github.com/fastify/fastify-multipart/blob/main/index.js
|
|
46
|
-
*/
|
|
47
|
-
export declare const fastifyMultipartErrorCodes: Record<string, MultipartErrorCode>;
|
|
48
|
-
/**
|
|
49
|
-
* `@fastify/multipart` error codes that already describe a client error and
|
|
50
|
-
* are reported as a 400 with their own message.
|
|
51
|
-
*/
|
|
52
|
-
export declare const fastifyMultipartBadRequestCodes: string[];
|
|
53
|
-
export declare const MISSING_PLUGIN_MESSAGE: string;
|
|
54
|
-
export declare const PLUGIN_NOT_REGISTERED_AT_STARTUP_MESSAGE: string;
|
|
55
|
-
export declare const WRONG_ADAPTER_MESSAGE: string;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Same codes and messages as multer's `MulterError`, copied from
|
|
3
|
-
* `@nestjs/platform-express` (`multer/multer/multer.constants.ts`) so that
|
|
4
|
-
* clients see identical error responses on both adapters without this
|
|
5
|
-
* package depending on platform-express.
|
|
6
|
-
*/
|
|
7
|
-
export const multerExceptions = {
|
|
8
|
-
// from https://github.com/expressjs/multer/blob/master/lib/multer-error.js
|
|
9
|
-
LIMIT_PART_COUNT: 'Too many parts',
|
|
10
|
-
LIMIT_FILE_SIZE: 'File too large',
|
|
11
|
-
LIMIT_FILE_COUNT: 'Too many files',
|
|
12
|
-
LIMIT_FIELD_KEY: 'Field name too long',
|
|
13
|
-
LIMIT_FIELD_VALUE: 'Field value too long',
|
|
14
|
-
LIMIT_FIELD_COUNT: 'Too many fields',
|
|
15
|
-
LIMIT_UNEXPECTED_FILE: 'Unexpected file field',
|
|
16
|
-
MISSING_FIELD_NAME: 'Field name missing',
|
|
17
|
-
LIMIT_FIELD_NESTING: 'Field name nesting too deep',
|
|
18
|
-
// A multer 2.4 code that platform-express's table lacks. Raised here for
|
|
19
|
-
// field names that would pollute a prototype, which multer accepts.
|
|
20
|
-
INVALID_FIELD_NAME: 'Invalid field name',
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* The messages platform-express reports for busboy 1.x parser errors
|
|
24
|
-
* (prefixed with "Multipart: "), which is what multer bundles.
|
|
25
|
-
*/
|
|
26
|
-
export const busboyExceptions = {
|
|
27
|
-
MULTIPART_BOUNDARY_NOT_FOUND: 'Multipart: Boundary not found',
|
|
28
|
-
MULTIPART_UNEXPECTED_END_OF_FORM: 'Multipart: Unexpected end of form',
|
|
29
|
-
MULTIPART_UNEXPECTED_END_OF_FILE: 'Multipart: Unexpected end of file',
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* `@fastify/busboy` raises plain `Error`s without a `code`, so these are the
|
|
33
|
-
* only messages matched verbatim. Everything `@fastify/multipart` raises is
|
|
34
|
-
* matched by its `code` instead (see `fastifyMultipartErrorCodes`).
|
|
35
|
-
*
|
|
36
|
-
* @see https://github.com/fastify/busboy/blob/main/deps/dicer/lib/Dicer.js
|
|
37
|
-
*/
|
|
38
|
-
export const fastifyBusboyMessages = {
|
|
39
|
-
BOUNDARY_NOT_FOUND: 'Multipart: Boundary not found',
|
|
40
|
-
// Emitted on the parser when the body ends early...
|
|
41
|
-
UNEXPECTED_END_OF_FORM: 'Unexpected end of multipart data',
|
|
42
|
-
// ...and on the file stream that was being read at that moment. Both are
|
|
43
|
-
// reported as "Unexpected end of form", as multer does for a truncated body.
|
|
44
|
-
PART_TERMINATED_EARLY: 'terminated early due to unexpected end',
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* `@fastify/multipart` error codes (created with `@fastify/error`) mapped to
|
|
48
|
-
* the multer code that describes the same condition.
|
|
49
|
-
*
|
|
50
|
-
* @see https://github.com/fastify/fastify-multipart/blob/main/index.js
|
|
51
|
-
*/
|
|
52
|
-
export const fastifyMultipartErrorCodes = {
|
|
53
|
-
FST_PARTS_LIMIT: 'LIMIT_PART_COUNT',
|
|
54
|
-
FST_FILES_LIMIT: 'LIMIT_FILE_COUNT',
|
|
55
|
-
FST_FIELDS_LIMIT: 'LIMIT_FIELD_COUNT',
|
|
56
|
-
FST_REQ_FILE_TOO_LARGE: 'LIMIT_FILE_SIZE',
|
|
57
|
-
FST_PROTO_VIOLATION: 'INVALID_FIELD_NAME',
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* `@fastify/multipart` error codes that already describe a client error and
|
|
61
|
-
* are reported as a 400 with their own message.
|
|
62
|
-
*/
|
|
63
|
-
export const fastifyMultipartBadRequestCodes = [
|
|
64
|
-
'FST_MP_PREMATURE_CLOSE',
|
|
65
|
-
'FST_INVALID_JSON_FIELD_ERROR',
|
|
66
|
-
];
|
|
67
|
-
export const MISSING_PLUGIN_MESSAGE = 'File upload interceptors from "@nestjs/platform-fastify/multipart" require the "@fastify/multipart" plugin, ' +
|
|
68
|
-
'which the FastifyAdapter registers unless its "multipart" option is false. ' +
|
|
69
|
-
'Either remove that option, or register the plugin yourself (`await app.register(multipart)`).';
|
|
70
|
-
export const PLUGIN_NOT_REGISTERED_AT_STARTUP_MESSAGE = 'File upload interceptors from "@nestjs/platform-fastify/multipart" require the "@fastify/multipart" plugin, ' +
|
|
71
|
-
'which was not registered before the Fastify instance started. ' +
|
|
72
|
-
'Register it at startup: `new FastifyAdapter({ multipart: true })`, or `await app.register(multipart)`.';
|
|
73
|
-
export const WRONG_ADAPTER_MESSAGE = 'File upload interceptors from "@nestjs/platform-fastify/multipart" only work with the FastifyAdapter. ' +
|
|
74
|
-
'With the ExpressAdapter, import them from "@nestjs/platform-express" instead.';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type MultipartErrorCode } from './multipart.constants.js';
|
|
2
|
-
/**
|
|
3
|
-
* Mirrors multer's `MulterError`: identified by `code`, and may carry the
|
|
4
|
-
* name of the offending `field`.
|
|
5
|
-
*/
|
|
6
|
-
export declare class MultipartError extends Error {
|
|
7
|
-
readonly code: MultipartErrorCode;
|
|
8
|
-
readonly field?: string | undefined;
|
|
9
|
-
constructor(code: MultipartErrorCode, field?: string | undefined);
|
|
10
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { multerExceptions, } from './multipart.constants.js';
|
|
2
|
-
/**
|
|
3
|
-
* Mirrors multer's `MulterError`: identified by `code`, and may carry the
|
|
4
|
-
* name of the offending `field`.
|
|
5
|
-
*/
|
|
6
|
-
export class MultipartError extends Error {
|
|
7
|
-
code;
|
|
8
|
-
field;
|
|
9
|
-
constructor(code, field) {
|
|
10
|
-
super(multerExceptions[code]);
|
|
11
|
-
this.code = code;
|
|
12
|
-
this.field = field;
|
|
13
|
-
this.name = 'MultipartError';
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { FastifyRequest } from 'fastify';
|
|
2
|
-
import type { IncomingMessage } from 'http';
|
|
3
|
-
import type { MultipartField, MultipartLimits, MultipartOptions, MultipartStorageEngine } from '../interfaces/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Where accepted files end up, named after multer's `FileAppender` strategies.
|
|
6
|
-
*/
|
|
7
|
-
export type FileStrategy = 'VALUE' | 'ARRAY' | 'OBJECT' | 'NONE';
|
|
8
|
-
export interface UploadSpec {
|
|
9
|
-
/** Accepted file fields; `'ANY'` accepts every field without a count limit. */
|
|
10
|
-
fields: MultipartField[] | 'ANY';
|
|
11
|
-
strategy: FileStrategy;
|
|
12
|
-
}
|
|
13
|
-
/** Same resolution order as multer: `storage`, then `dest`, then memory. */
|
|
14
|
-
export declare function resolveStorage(options: MultipartOptions): MultipartStorageEngine;
|
|
15
|
-
/**
|
|
16
|
-
* Stops parsing and discards the rest of the body, so that an error response
|
|
17
|
-
* does not race a client that is still uploading (multer does the same
|
|
18
|
-
* before it reports an error).
|
|
19
|
-
*/
|
|
20
|
-
export declare function drainRequest(raw: IncomingMessage): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Rejects limits that are not a non-negative integer or `Infinity`, as
|
|
23
|
-
* multer does: busboy compares most limits with strict equality, so such a
|
|
24
|
-
* value would silently disable the limit.
|
|
25
|
-
*/
|
|
26
|
-
export declare function validateLimits(limits: MultipartLimits | undefined): void;
|
|
27
|
-
/**
|
|
28
|
-
* Parses the multipart body with multer's semantics and populates
|
|
29
|
-
* `req.body` and `req.file` / `req.files`. Requests that are not multipart
|
|
30
|
-
* are passed through untouched, as multer does.
|
|
31
|
-
*/
|
|
32
|
-
export declare function processMultipart(request: FastifyRequest, spec: UploadSpec, options: MultipartOptions, storage: MultipartStorageEngine): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Parses up to and including the first file in `fieldName`, then stops and
|
|
35
|
-
* hands that file's stream to the route handler (`req.file.stream`). Text
|
|
36
|
-
* fields sent before the file are in `req.body`; anything after it is not
|
|
37
|
-
* parsed.
|
|
38
|
-
*/
|
|
39
|
-
export declare function processStream(request: FastifyRequest, fieldName: string, options: MultipartOptions): Promise<void>;
|