@metreeca/http - v0.1.1
    Preparing search index...

    Module protocol

    Custom protocol handler middleware.

    Serves a URI scheme the platform doesn't resolve through a custom handler, leaving every other exchange to the standard fetch function.

    Content held on a filesystem, in an archive or in any other local store is then addressed by URI like a remote resource and retrieved through a single client, rather than through a store-specific API call sites have to branch to. The middlewares layered over that client apply to local and remote exchanges alike.

    Usage

    import { createFetch } from "@metreeca/http";
    import { protocol } from "@metreeca/http/protocol";

    const client = createFetch(
    protocol("file", files), // handler serving file:
    protocol("zip", archives) // handler serving zip:
    );

    await client("file:///var/data/hosts"); // served by the handler
    await client("https://example.com/"); // served by the platform
    protocol

    Creates a protocol dispatching middleware.