Skip to content

DenoHttpPlatform

Deno implementation of the Effect HTTP platform service.

File responses use Deno.FsFile.readable directly so full-file responses retain Deno's resource-backed fast path. Deno closes the file after the body is sent, but server adapters must cancel a raw body when they do not send it, including when handling HEAD requests.

The provided layer uses strong ETags, unlike the portable HttpPlatform layer, which uses weak ETags.

2 exports Added in v4.0.0 Source

Constructors

make

Added in v4.0.0 Source

Creates the Deno HttpPlatform, serving file responses from resource-backed readable streams and adding content type and content length headers.

Signature

declare const make: Effect<
  {
    readonly fileResponse: (
      path: string,
      options?: WithContent & {
        readonly bytesToRead?: SizeInput;
        readonly chunkSize?: SizeInput;
        readonly offset?: SizeInput;
      },
    ) => Effect<HttpServerResponse, PlatformError>;
    readonly fileWebResponse: (
      file: FileLike,
      options?: WithContent & {
        readonly bytesToRead?: SizeInput;
        readonly chunkSize?: SizeInput;
        readonly offset?: SizeInput;
      },
    ) => Effect<HttpServerResponse>;
  },
  never,
  Generator | FileSystem
>;

Layers

layer

Added in v4.0.0 Source

Provides the Deno HttpPlatform together with its filesystem and strong ETag services.

Signature

declare const layer: Layer.Layer<Platform.HttpPlatform>;