Home > front end >  Return a large video file to client (Firebase Cloud Function)
Return a large video file to client (Firebase Cloud Function)

Time:10-28

On a request, I create a large (~30MB) video file (held in /tmp folder) and need to return it to the user, I am just wondering how I return that file to the client/user. What methods I can use?

I tried directly with the raw data (base64) but there is a 10MB response limit. I've also tried uploading the file to firebase storage, but that comes with a price, wondering if any other cheaper or free ways

CodePudding user response:

Try to return file as stream.

Something like const fileStream = fs.createReadStream('/tmp/file') to create reading stream and pipe to response like fileStream.pipe(res) (if res your Express response object).

  • Related