1

When use multer, you can't get the uploaded stream, you just get the buffer when the upload ends. so I think there is no way to use

@UseInterceptors(FileInterceptor('file'))
@Post()
upload(@UploadedFile() file: Express.Multer.File, @GetUser() user) {
        return this._myService.upload(user._id, file);
    }

I tried busboy to get the chunks of uplaoded file and got it, but how to response to the client about the progress!?

  • Were you able to solve this issue? – dev404 Mar 04 '22 at 16:50
  • No, you can say it's not an issue, the default [behavior of SSE](https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) you can't set a header nor a payload, but there is a library to work around like [sse.js](https://github.com/mpetazzoni/sse.js) – ibrahim Ad_Dandan Mar 05 '22 at 11:36
  • 1
    if you want just the uploading progress do it from the client/front-end, but if you want to send notification a bout cloud uploading or parsing the file, send these notifications through a separated SSE channel and determine the event. – ibrahim Ad_Dandan Mar 05 '22 at 11:41

0 Answers0