-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(platform): add multer support for fastify platform #4921
Conversation
Pull Request Test Coverage Report for Build c9974085-88e3-4546-b56a-9322d1eed8b8
💛 - Coveralls |
I am looking forward to using this feature <3 |
You beat me to it! I was doing literally the exact same thing today! Good stuff, hope this gets merged soon |
/** Location of the uploaded file (DiskStorage) */ | ||
path: string; | ||
/** A Buffer of the entire file (MemoryStorage) */ | ||
buffer: Buffer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fastify-multer
adds another field here called stream
of type NodeJS.ReadableStream
@@ -20,6 +20,8 @@ | |||
"fastify": "2.14.1", | |||
"fastify-cors": "3.0.3", | |||
"fastify-formbody": "3.2.0", | |||
"fastify-multer": "^1.5.4", | |||
"fastify-multipart": "^1.0.6", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think this is used in the code added, the user has to register this package on the adapter in the main.ts
file
@kamilmysliwiec any thoughts on PR? #2088 was closed due to fastify-multer being a too young library, but a year has passed since then |
Any update on this pull? I think it should accepted @kamilmysliwiec |
Should we consider adding this support through the official core https://github.com/fastify/fastify-multipart package, instead of fastify-multer from the community? This feature would be configured and used differently than multer for Express, but is it an issue? @kamilmysliwiec what are your thoughts on that? |
Is there a timeline for this feature? What is currently the best way to use the file upload with fastify in nestjs? The only blocker we have, which blocks the migration to nestjs with fastify. |
Same here, do you guys have a timeline? |
May I ask what is the status of this pull request? File upload is an essential part of our app and since we would like to use Fastify, the availability of an officially supported FileInterceptor is key. |
Any news on this? |
Also wondering what’s the status ? |
Would also like to know what needs to happen to make this PR to be merged |
@kamilmysliwiec any chance of this getting merged? Is it just a case to fix merge conflicts? |
Because if its long time not merged, then maybe package it up as a package for others to use? Because there is no response from @kamilmysliwiec and there are quite a few people who'd like to use it. What do you think @gperdomor ? |
I had to revert back a project from fastify to express because multer integration was too complex / would have taken too much time :( |
A new MR is in progress: #6935 |
For those who are stuck in this issues with mulher I found a way to workaround it fastify-multer and it worked quite fine. |
any progress on this? |
@kamilmysliwiec |
@EvilCheetah If you need this, I've created |
@jmcdo29 thank you for creating this package! Why is this MR not getting the attention as it should? 2 years passed since the MR and it still didn't get merge. |
Because it relies on a tiny package that is out of our control. |
Since unfortunatelly this PR hasn't been merged and all the current solutions I found in the web don't fit my needs or are unstable, I decided to create my own solution based on Interceptors and '@fastify/multipart`. I leave the code here just in case someone came here in the future :) main.ts
UploadService.ts | NOTE: The localstack variables are just for testing, you can use localstack or a production S3.
UploadInterceptor.ts
ExampleController.ts
|
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
File upload using Multer is only supported for express adapter
Issue Number: N/A
What is the new behavior?
Add fastify-multer support in @nestjs/platform-fastify.
Does this PR introduce a breaking change?
Other information