@nestjs/platform-fastify
Version:
Run NestJS on Fastify: the HTTP adapter with Fastify's plugins, JSON schemas and serialization.
16 lines (15 loc) • 689 B
JavaScript
import { createMultipartInterceptor } from '../multipart/multipart-interceptor.factory.js';
/**
* Accepts up to `maxCount` files in `fieldName` and exposes them as an array
* in `req.files` (`@UploadedFiles()`). The Fastify counterpart of
* platform-express's `FilesInterceptor`.
*
* @param fieldName name of the form field that carries the files
* @param maxCount maximum number of files to accept
* @param localOptions options merged over the `MultipartModule` defaults
*
* @publicApi
*/
export function FilesInterceptor(fieldName, maxCount, localOptions) {
return createMultipartInterceptor({ fields: [{ name: fieldName, maxCount }], strategy: 'ARRAY' }, localOptions);
}