Serve pdf file in get route in Astro

Hi, im trying to serve a pdf file in a get route, as such:
import fs from "fs";

export async function get({ params, request }) {
  const buff = fs.readFileSync("public/resume.pdf", "binary");
  fs.createReadStream;
  return new Response(buff.toString(), {
    status: 200,
    headers: {
      "content-type": "application/pdf",
      "content-disposition": "attachment; filename=resume.pdf",
    },
  });
}

and getting this error(see attachment)
anyone know how to do this?
Was this page helpful?