Generate (large) files with a serverless function

Hello, I am a newbie to jamstack. I have a question about serverless function on netlify.

Can I create a serverless function who generate PDF files. And another who treat videos ? Files will be stored few seconds on netlify server until my cms pull it. I have the feeling that serverless function isn’t made to generate/store files.

I hearded about netlify large media, but if i am not mistaken, it is for larges code files

:wave: @dbconception

Generic functions won’t be usefull here since they have a runtime limit of 10 seconds.

May I suggest background functions which have a limit of 15 seconds.

With them, you should have the flexibility to generate PDFs while processing the videos with perhaps a third party service.

Hope this helps!

Ok I will look for background function. And about size of files on the disk, do I have any limitation ?

I readed anywhere that the files generated are removed at the end of the function execution. Is it true ?

Thank’s for your help

Depends on what you’ll do with them. Our functions run on AWS Lambdas so you’re limited to that execution context.

You’ll need to POST the resulting object somewhere else because they cannot live on the function forever.

What exactly are you trying to achieve?

Ok I understand. I will do it.

  1. A hook in my directus backoffice will trigger the serverless background function
  2. So the serverless function will generate files, then upload it on directus before the end of his execution

Thank you very much

1 Like

You’re welcome!

Happy coding :wave:

1 Like