Consume an HTTP request or response stream until all headers have been read, leaving the stream ready to consume the body from the start. Version 1.0.0 is stable with a simple callback-based API. It parses headers from a TCP stream (e.g., net.Socket) and returns the parsed headers object. Lightweight, no dependencies, and focused solely on header consumption without handling chunked transfer encoding or body parsing. Alternatives like `http-parser-js` provide more complete parsing but are heavier.
npm install consume-http-headerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to example.com, sends an HTTP GET request, consumes the response headers, and pipes the body to stdout.
Ensure the stream is a raw TCP connection before any HTTP parsing.
Check for err in the callback and handle stream end properly.
After consuming headers, handle chunked body manually or use a module like 'chunked-transfer'.
Use const consume = require('consume-http-header')Ensure the server sends complete headers; check network connectivity.
No dependency data recorded yet.