Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@webundsoehne/nest-fastify-file-upload
Advanced tools
Port of NestJS FileInterceptor & MulterModule for FastifyAdapter
Compatibile with NestJS 7-10 and Fastify 3-4.
Install to your project:
npm i @webundsoehne/nest-fastify-file-upload
IMPORTANT: Register contentParser
in your root application after creation:
import { NestFactory } from '@nestjs/core'
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify'
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
import { contentParser } from 'fastify-multer'
import { AppModule } from './app.module'
async function bootstrap (): Promise<void> {
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter())
await app.register(contentParser)
await app.listen(3000)
}
bootstrap()
Use it like the official NestJS package for Express in your controllers:
@Post('upload')
@UseInterceptors(FileInterceptor('file'))
@ApiFileBody('file')
@ApiConsumes('multipart/form-data')
uploadFile (@UploadedFile('file') file: MulterFile): void {
console.log(file)
}
...
The package will export the missing Express.Multer.*
types as Multer*
.
more information: https://docs.nestjs.com/techniques/file-upload
Useful controller decorator that adds file upload functionality in Swagger.
You can specify the file key as parameter, default key is file
.
Register the MulterModule e.g. to directly upload to a specified directory.
import { Module } from '@nestjs/common'
import { AppController } from './app.controller'
import {MulterModule} from "../multer.module";
@Module({
controllers: [AppController],
imports: [
MulterModule.register({dest: './uploads'})
]
})
export class AppModule { }
more information and options: https://docs.nestjs.com/techniques/file-upload#default-options
FAQs
Port of NestJS FileInterceptor & MulterModule for FastifyAdapter
We found that @webundsoehne/nest-fastify-file-upload demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.