How to Build & send video files via netlify functions?

lets take an example case , My lambda function combines 3 images to a .mp4 video file.
now I have to send this newly created video to clientside so user can view it,
In nodejs there is a function for it (res.sendFile) but in lambda function there is nothing as rsponse.
I know I can send buffers to client as string but then how can I complie it to video.mp4 on clientside?

Hey @umer2001 and welcome :slight_smile:
We can’t advise on the best way to compile images to mp4 in Javascript since that’s beyond what we can provide technical support around, but I can tell you that res.sendFile is an Express function, and you can import Express into your Netlify lambda/function. Here’s a blog post on how:

Do note that the Netlify function has 10 seconds to finish executing before it times out, so if compiling to mp4 is a long process, you may not have time to do it within the function.

Let us know if that helps or if you have other questions!

Thankyou for your response :smiley:, I knew I can setup express in lambda function but I thought it will be very heavy task,
and yes, I came to know about 10 sec limit very late when I coded the whole think up :laughing:

and then I decides to host it on heroku free of cost I am telling this because if somebody come on my post to search related his hardwork also don’t get waste.

Yup, I think Heroku is probably a better service for your workflow :slight_smile: Netlify isn’t trying to solve every problem on the web; there are some things that our service can do that others can do better or that we can’t do at all.

While this is in the former category, I think you’ll have an easier time without the runtime limits and with better logging as you develop, on Heroku.

Thanks for the follow-up!