You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want access to the ReadStream stream from Multer to pass through my application to then consume somewhere later in my application.
From the README.md link, I followed a very basic implementation to simply expose the ReadStream from file.stream. I removed all error handling and stream cleanup to provide a terse example.
I am having issues (might be NestJS framework related, or it might be my implementation below). Can anyone confirm the success callback works if simply providing the internal file.stream object is enough, as below?
classStreamEngineimplementsStorageEngine{_handleFile(req: Request,file: Express.Multer.File,callback: (error: Error|null,info?: Partial<AsyncFile>)=>void,): void{// Not sure a passThrough is even neededconstpassThrough=newPassThrough();file.stream.pipe(passThrough);// Execution reaches this callback, but the execution // doesn't continue later in the NestJS framework controllercallback(null,{fieldname: file.fieldname,stream: passThrough});})_removeFile(req: Request,file: AsyncFile,callback: (error: Error|null)=>void,): void{callback(null);}}
In my case, once Multer reaches the success callback the application doesn't continue (In my NestJS framework controller).
(I'm not even sure a passThrough has any benefit given I am not transforming the stream at all but without it I have the same issue.)
In my application I pass the Readable to another library (form-data) to consume the stream. My implementation after receiving the express file object seems correct since I tested by manually creating a test ReadStream via Readable.from(createReadStream("./50Mbfile") and passing that through to the form-data library and it works as expected.
I am still working on a minimal reproduction example without an additional framework like NestJS.
The text was updated successfully, but these errors were encountered:
I want access to the ReadStream stream from Multer to pass through my application to then consume somewhere later in my application.
From the README.md link, I followed a very basic implementation to simply expose the ReadStream from
file.stream
. I removed all error handling and stream cleanup to provide a terse example.I am having issues (might be NestJS framework related, or it might be my implementation below). Can anyone confirm the success callback works if simply providing the internal
file.stream
object is enough, as below?In my case, once Multer reaches the success callback the application doesn't continue (In my NestJS framework controller).
(I'm not even sure a
passThrough
has any benefit given I am not transforming the stream at all but without it I have the same issue.)In my application I pass the Readable to another library (form-data) to consume the stream. My implementation after receiving the express file object seems correct since I tested by manually creating a test ReadStream via
Readable.from(createReadStream("./50Mbfile")
and passing that through to the form-data library and it works as expected.I am still working on a minimal reproduction example without an additional framework like NestJS.
The text was updated successfully, but these errors were encountered: