Creates a response for serving a file.

  • Parameters

    • pathToFile: string

      The path to the file to be served.

    • options: ResponseInit = {}

      Optional response initialization options.

    Returns Promise<Response>

    A Response object containing the file data.

    Example usage:

    import { start, router, file } from "@pulsar-http/core";

    const routes = [
    router.get("/", async () => file("public/index.html")),
    ];

    start({ routes });

    In this example, the response will serve the file located at "public/index.html".