
File Upload
Multer, file validation, storage, streaming, S3 integration, file size limits
1Which package to use for handling file uploads in NestJS?
Which package to use for handling file uploads in NestJS?
Jawaban
NestJS uses Multer via @nestjs/platform-express to handle multipart/form-data uploads. Multer is integrated by default with NestJS Express platform. It provides decorators like @UseInterceptors(FileInterceptor()) to simplify uploads. Express-fileupload and body-parser are not recommended with NestJS.
2How to upload a single file in a NestJS endpoint?
How to upload a single file in a NestJS endpoint?
Jawaban
FileInterceptor('file') is the decorator for uploading a single file, where 'file' is the form field name. FilesInterceptor is for multiple files from the same field, FileFieldsInterceptor for multiple different fields. @UploadedFile() alone doesn't work without an interceptor.
3How to upload multiple files from the same field in NestJS?
How to upload multiple files from the same field in NestJS?
Jawaban
FilesInterceptor('files', 10) allows uploading up to 10 files from the 'files' field. The second parameter limits the number of files. FileInterceptor is for a single file, AnyFilesInterceptor for all fields without limit, and multiplying FileInterceptor doesn't work.
How to validate the MIME type of an uploaded file in NestJS?
How to limit an uploaded file size to 5 MB in NestJS?
+12 pertanyaan wawancara
Topik wawancara Node.js / NestJS lainnya
Node.js Fundamentals
Node.js Core APIs
Asynchronous Programming
Express.js Basics
NestJS Fundamentals
REST API Design
Validation & DTO
API Documentation & Contracts
Error Handling
Unit Testing
Task Scheduling
NestJS Modules & DI
Configuration & Environment Management
JWT Authentication
Authorization & RBAC
Database with TypeORM
Prisma ORM
Middleware & Interceptors
WebSockets
GraphQL with NestJS
End-to-End Testing
Caching with Redis
Queues with Bull
DevOps, Logging & CI/CD
Docker & Containerization
Microservices
Security Best Practices
Performance & Cloud Deployment
Kuasai Node.js / NestJS untuk wawancara berikutnya
Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.
Mulai gratis