# MulterFileSize Decorator multer
Module | import { MulterFileSize } from "@tsed/multipartfiles" |
---|---|
Source | /packages/multipartfiles/src/decorators/multerFileSize.ts |
# Overview
function MulterFileSize(fileSize: number): MethodDecorator;
# Description
Define file size limit.
import {Controller, Post} from "@tsed/common";
import {MulterOptions, MultipartFile} from "@tsed/multipartfiles";
import {Multer} from "@types/multer";
type MulterFile = Express.Multer.File;
@Controller('/')
class MyCtrl {
@Post('/file2')
@MulterFileSize(1024) // (Ko). Applied for all fields
private uploadFile(@MultipartFile("file1") file: MulterFile, @MultipartFile("file2") file2: MulterFile) {
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
See the tutorial on the multer configuration.
- Session & cookies
- Passport.js
- TypeORM
- Mongoose
- GraphQL
- Socket.io
- Swagger
- AJV
- Multer
- Serve static files
- Templating
- Throw HTTP Exceptions
- Customize 404
- AWS
- Jest
- Seq
- Controllers
- Providers
- Model
- Converters
- Middlewares
- Pipes
- Interceptors
- Authentication
- Hooks
- Injection scopes
- Custom providers
- Custom endpoint decorator
- Testing