Registry / devops / parse-raw-http

parse-raw-http

JSON →
library0.0.1jsnpmunverified

A Node.js library for parsing HTTP responses directly from raw over-the-wire byte streams, including support for chunked transfer encoding and Content-Encoding decoding (e.g., gzip). Version 0.0.1 is an early release with basic functionality; the API is unstable and may change before a 1.0 release. It differentiates itself by requiring explicit options (no guessing), making it suitable for low-level HTTP stream processing where control over decoding is critical. The library is intended for use with raw TCP data, such as from proxy captures or WARC files, and plans to be tested against Common Crawl data for robustness.

npm install parse-raw-http
INSTALL
IMPORT
SIG · PARSE-RAW-HTTP
P
parse-raw-http
devopsjavascriptv0.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parseResponse
const { parseResponse } = require('parse-raw-http')
import { parseResponse } from 'parse-raw-http'
The library only provides a CommonJS entry point; ESM imports are not supported.
parseResponse
import { parseResponse } from 'parse-raw-http'
This import works only if the library adds ESM support in the future; currently it does not exist.
default
const parseRawHttp = require('parse-raw-http')
const { parseRawHttp } = require('parse-raw-http')
There is no default export; the library exports only named functions.

Demonstrates parsing a raw HTTP response with chunked transfer encoding and decoding the body.

const { parseResponse } = require('parse-raw-http'); const data = Buffer.from( 'HTTP/1.1 200 OK\r\n' + 'Content-Type: text/plain; charset=utf-8\r\n' + 'Transfer-Encoding: chunked\r\n' + '\r\n' + '4\r\nFoo\n' + '1a\r\nChunk with 1a=16+10 bytes\n' + '0\r\n\r\n', 'utf8' ); const res = parseResponse(data, { decodeContentEncoding: true, }); console.log(res.statusCode); // 200 console.log(res.statusMessage); // 'OK' console.log(res.headers['content-type']); console.log(res.bodyData.toString());
Debug
Known issues
breakingThe API is version 0.0.1 and is unstable. Functions and options may change without notice.
fix
Pin to exact version and test thoroughly with each update.
affects: >=0.0.1 <1.0.0
gotchaAll options in parseResponse must be specified; there are no defaults.
fix
Always provide an options object when calling parseResponse.
affects: >=0.0.1
gotchaThe library does not validate input; malformed HTTP data may crash or produce undefined behavior.
fix
Ensure input data is valid raw HTTP bytes before parsing.
affects: >=0.0.1
gotchaOnly HTTP response parsing is supported; request parsing is not available.
fix
Use a different library (e.g., http-parser-js) for parsing HTTP requests.
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'parse-raw-http'
The package is not installed or is missing from package.json.
fix
Run 'npm install parse-raw-http' and ensure it is in dependencies.
TypeError: parseResponse is not a function
The import syntax is incorrect; likely using default import instead of named import.
fix
Use const { parseResponse } = require('parse-raw-http')
TypeError: Cannot read property 'statusCode' of undefined
The call to parseResponse is missing options object.
fix
Call parseResponse(data, { decodeContentEncoding: true })
Upgrade
Version history
0.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
parse-raw-http — npm install parse-raw-http · libregistry