Bun

Serve the Files gateway from Bun.serve. The gateway's handle(req) is already a Web fetch handler, so it drops straight into a route - no adapter needed.

Bun.serve hands your handler a Web Request and sends back whatever Response you return — which is exactly the shape the gateway speaks (handle(req: Request): Promise<Response>). So there is no files-sdk/bun adapter to import: drop router.handle straight into a route.

server.ts
import { createFiles } from "files-sdk";
import { s3 } from "files-sdk/s3";
import { createFilesRouter } from "files-sdk/api";

const router = createFilesRouter({
  files: createFiles({ adapter: s3({ bucket: "uploads" }) }),
  allowedOrigins: ["https://app.example.com"],
  authorize: async ({ req }) => {
    /* throw to deny, or return a per-user constraint — see /ui/server/authorization */
  },
});

Bun.serve({
  port: 3000,
  routes: {
    // A bare handler runs for every method; the gateway dispatches internally
    // (GET = download, POST = the JSON verbs, PUT = upload).
    "/api/files": (req) => router.handle(req),
  },
});

Want routing and middleware on Bun? Hono and Elysia both run on Bun and have their own bindings — the gateway is the same underneath.

See the gateway options for the full configuration and the authorize model for locking it down.