Hyperquest is a lightweight, streaming HTTP client for Node.js, last updated to version 2.1.3 approximately eight years ago. It was created by Substack to address fundamental shortcomings in Node.js's native `http` module prior to version 0.12, specifically concerning default idle timeouts (2 minutes) and a restrictive connection pool limit (5 requests). These defaults often led to applications hanging or experiencing unexpected behavior when making multiple concurrent HTTP requests. Hyperquest bypassed these internal Node.js annoyances by treating HTTP requests purely as streaming transports, removing pooling and extending default timeouts significantly. While it offered a streamlined, 'request'-like API, it was designed for raw streaming without buffering or automatic JSON parsing. Given that its core purpose was to mitigate issues resolved in much older Node.js versions (specifically, Node.js 0.12 and later fixed many of these `http` module defaults), the package is now considered abandoned and not suitable for modern Node.js development.
npm install hyperquestVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic streaming GET request using `hyperquest` to a local HTTP server and piping the response to standard output.
For modern Node.js, rely on the native `http` module, `undici`, `node-fetch`, or `axios`. Configure `agent` options (like `maxSockets`, `keepAlive`, `timeout`) directly on native HTTP agents as needed. For example, use `new http.Agent({ keepAlive: true, maxSockets: Infinity })`.Migrate to actively maintained and modern HTTP clients like `undici` (built-in Node.js `fetch`), `node-fetch`, or `axios`. If streaming is critical, explore stream-based solutions within these modern clients or libraries built on top of them.
If used in an ESM project, you must use `require` via `createRequire` from the `module` built-in module: `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const hyperquest = require('hyperquest');`. However, migrating away from `hyperquest` is strongly recommended.Always attach `data`, `end`, and `error` event handlers to the returned stream. Accumulate data chunks if a complete response body is needed, and parse manually (e.g., `JSON.parse(Buffer.concat(chunks).toString())`) if the content type is JSON.
This error indicates a module system mismatch. Since `hyperquest` is CommonJS, if you are in an ESM file, you must use `import { createRequire } from 'module'; const require = createRequire(import.meta.url); const hyperquest = require('hyperquest');`. However, consider migrating to a modern, actively maintained HTTP client with native ESM support.Ensure that the `hyperquest()` function is called with a well-formed URL string. For example: `hyperquest('http://example.com/api')`.