# Generate (large) files with a serverless function

**URL:** <https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049>\
**Category:** Support\
**Tags:** netlify-large-media-nlm, netlify-newbie\
**Created:** [July 25, 2022, 7:15pm UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049 "2022-07-25T19:15:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbconception](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dbconception](https://answers.netlify.com/u/dbconception)\
**Post date:** [July 25, 2022, 7:15pm UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/1 "2022-07-25T19:15:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gualter](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gualter/32/35068_2.png) [@gualter](https://answers.netlify.com/u/gualter)\
**Post date:** [July 25, 2022, 8:30pm UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/2 "2022-07-25T20:30:53Z")

</div>

👋 @dbconception

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

May I suggest [background functions](https://docs.netlify.com/functions/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!

---

<div class="post-metadata">

**Author:** ![dbconception](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dbconception](https://answers.netlify.com/u/dbconception)\
**Post date:** [July 25, 2022, 10:06pm UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/3 "2022-07-25T22:06:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gualter](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gualter/32/35068_2.png) [@gualter](https://answers.netlify.com/u/gualter)\
**Post date:** [July 25, 2022, 10:28pm UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/4 "2022-07-25T22:28:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dbconception](https://avatars.discourse-cdn.com/v4/letter/d/2bfe46/32.png) [@dbconception](https://answers.netlify.com/u/dbconception)\
**Post date:** [July 26, 2022, 7:29am UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/5 "2022-07-26T07:29:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gualter](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gualter/32/35068_2.png) [@gualter](https://answers.netlify.com/u/gualter)\
**Post date:** [July 26, 2022, 7:44am UTC](https://answers.netlify.com/t/generate-large-files-with-a-serverless-function/72049/6 "2022-07-26T07:44:13Z")

</div>

You’re welcome!

Happy coding 👋
