---
number: 32815
slug: 32815-add-static-files-to-edge-functions
published: 2025-01-15
discussion: https://github.com/orgs/supabase/discussions/32815
labels:
  - edge functions
page: https://supabase.com/changelog/32815-add-static-files-to-edge-functions
---

# Add static files to Edge Functions

Supabase CLI 2.7.0 adds support for bundling Edge Functions with static files.

You can access bundled files via Deno's file-system APIs. Here's an example function that serves a PDF file.

```ts
import fs from 'node:fs'; // This should be the first import to prevent other modules to trying to use their own polyfills.


Deno.serve(async () => {
  return new Response(
    await Deno.readFile("./my-book.pdf"),
    {
      headers: {
        "Content-Type": "application/pdf",
        "Content-Disposition": 'attachment; filename="my-book.pdf"',
      },
    },
  );
});
```

### Use cases

* Use custom Wasm modules in your Edge Functions ([check this guide](https://supabase.com/docs/guides/functions/wasm) for more details on how to write & use wasm modules in Edge Functions)
* Create paywalls for serving digital content like ebooks
* HTML email templates for sending emails using Edge Functions
 
### How to configure

You will need to add static files to the function's directory to bundle them. Then, in the `supabase/config.toml` file for the project, add these lines:

```toml
[functions.buy-book]
static_files = [ "./functions/buy-book/my-book.pdf" ]
```

You can specify an array of files or use a glob pattern (eg: "./functions/email-templates/*.html")

Check the CLI configuration reference for more details: https://supabase.com/docs/guides/local-development/cli/config#functions.function_name.static_files

**Note**: This feature is currently not available with branching and will be added with the next stable release of the CLI.
