A Fetch API client for Node.js that supports HTTP/1.1 and HTTP/2 with automatic protocol negotiation via ALPN. Current stable version is 3.0.2, published on npm, with semi-regular releases. Key differentiators include transparent HTTP/2 support, cookie management, built-in response compression (br, gzip, deflate), and TypeScript types. It uses the native Node.js http, https, and http2 modules without external dependencies, and manages sessions and socket reuse automatically. It provides a familiar browser-like fetch API extended for Node.js streams and offers context-based cookies and custom decoders.
npm install fetch-hNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Performs a GET request to httpsbin.org using fetch-h2, checks the response status, and parses JSON body.
Upgrade Node.js to 12 or higher.
Use import syntax (e.g., import { fetch } from 'fetch-h2') or switch to dynamic import().Pass context options directly to fetch() instead of using context().
Example: fetch(url, { redirect: 'follow' })Use 'http2://' for h2c connections.
Use dynamic import() or switch to ES modules (e.g., "type": "module" in package.json).
Use import { fetch } from 'fetch-h2' instead of import fetch from 'fetch-h2'.Set a timeout via AbortController or use the 'timeout' option if supported (community note: not officially documented).
No dependency data recorded yet.