Skip to content

@xtandard/kit/adapters/node

@xtandard/kit/adapters/node — the Fetch ↔ Node bridge shared by Express and the CLI: appended multi-value headers, re-serialised pre-parsed bodies, every Set-Cookie kept, response bodies streamed with backpressure and cancelled on disconnect.

import { … } from "@xtandard/kit/adapters/node";
Name Summary
headersFrom Copy Node headers into Headers, appending each value of a multi-value header.
requestUrl The absolute URL of a Node request; originalUrl keeps an Express mount prefix.
toNodeHandler Wrap a fetch handler as a node:http request listener.
toWebRequest Convert a Node (or Express) request into a web Request.
writeWebResponse Write a web Response to a Node ServerResponse, streaming the body with backpressure. Stops reading (and cancels the body) when the client disconnects.
Name Summary
NodeHandlerOptions Options for toNodeHandler.
ToWebRequestOptions Options for toWebRequest.
Name Summary
FetchHandler A web-standard fetch handler.
NodeRequest A Node request, possibly decorated by Express (originalUrl, protocol, body).