import { readFile } from "node:fs/promises";
import path from "node:path";

export const runtime = "nodejs";
export const dynamic = "force-dynamic";

export async function GET() {
    const pdf = await readFile(path.join(process.cwd(), "public", "downloads", "iRoof-Catalogue.pdf"));
    return new Response(pdf, {
        headers: {
            "Content-Type": "application/pdf",
            "Content-Disposition": 'attachment; filename="iRoof-Catalogue.pdf"',
            "Content-Length": String(pdf.byteLength),
            "Cache-Control": "no-store",
            "X-Content-Type-Options": "nosniff",
        },
    });
}
