| /** | |
| * Platform-specific support for serving files as HTTP server responses. | |
| * | |
| * `HttpPlatform` is the boundary between the portable HTTP response model and | |
| * the runtime that knows how to stream bytes from the host platform. Server | |
| * code uses this service when it needs to return local files, static assets, | |
| * downloads, byte ranges, or Web `File`-like values without constructing the | |
| * response body by hand. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| import * as Context from "../../Context.ts"; | |
| import * as Effect from "../../Effect.ts"; | |
| import * as FileSystem from "../../FileSystem.ts"; | |
| import * as Layer from "../../Layer.ts"; | |
| import type { PlatformError } from "../../PlatformError.ts"; | |
| import * as Etag from "./Etag.ts"; | |
| import * as Headers from "./Headers.ts"; | |
| import type * as Body from "./HttpBody.ts"; | |
| import * as Response from "./HttpServerResponse.ts"; | |
| declare const HttpPlatform_base: Context.ServiceClass<HttpPlatform, "effect/http/HttpPlatform", { | |
| readonly fileResponse: (path: string, options?: Response.Options.WithContent & { | |
| readonly bytesToRead?: FileSystem.SizeInput | undefined; | |
| readonly chunkSize?: FileSystem.SizeInput | undefined; | |
| readonly offset?: FileSystem.SizeInput | undefined; | |
| }) => Effect.Effect<Response.HttpServerResponse, PlatformError>; | |
| readonly fileWebResponse: (file: Body.HttpBody.FileLike, options?: Response.Options.WithContent & { | |
| readonly bytesToRead?: FileSystem.SizeInput | undefined; | |
| readonly chunkSize?: FileSystem.SizeInput | undefined; | |
| readonly offset?: FileSystem.SizeInput | undefined; | |
| }) => Effect.Effect<Response.HttpServerResponse>; | |
| }>; | |
| /** | |
| * Service for platform-specific HTTP response helpers, including file-backed server responses. | |
| * | |
| * @category services | |
| * @since 4.0.0 | |
| */ | |
| export declare class HttpPlatform extends HttpPlatform_base { | |
| } | |
| /** | |
| * Creates an `HttpPlatform` service from platform-specific file response constructors, using `FileSystem` and `Etag.Generator`. | |
| * | |
| * @category constructors | |
| * @since 4.0.0 | |
| */ | |
| export declare const make: (impl: { | |
| readonly fileResponse: (path: string, status: number, statusText: string | undefined, headers: Headers.Headers, start: number, end: number | undefined, contentLength: number) => Response.HttpServerResponse; | |
| readonly fileWebResponse: (file: Body.HttpBody.FileLike, status: number, statusText: string | undefined, headers: Headers.Headers, options?: { | |
| readonly bytesToRead?: FileSystem.SizeInput | undefined; | |
| readonly chunkSize?: FileSystem.SizeInput | undefined; | |
| readonly offset?: FileSystem.SizeInput | undefined; | |
| }) => Response.HttpServerResponse; | |
| }) => Effect.Effect<HttpPlatform["Service"], never, Etag.Generator | FileSystem.FileSystem>; | |
| /** | |
| * Provides the default `HttpPlatform` implementation for serving file paths and | |
| * `File`-like values as streamed HTTP responses. | |
| * | |
| * **Details** | |
| * | |
| * The layer uses the `FileSystem` and weak ETag services to add file metadata | |
| * headers such as `etag` and `last-modified`. | |
| * | |
| * @category layers | |
| * @since 4.0.0 | |
| */ | |
| export declare const layer: Layer.Layer<HttpPlatform, never, FileSystem.FileSystem>; | |
| export {}; | |
| //# sourceMappingURL=HttpPlatform.d.ts.map |
Xet Storage Details
- Size:
- 3.21 kB
- Xet hash:
- 0391fd0b1fc75f0735616c05933ca6bc7ad62c3601fbf01baacaeda8a1300dc1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.