{"id":41265,"library":"http-raw","title":"http-raw","description":"Creates an HTTP server that exposes the raw request data, including headers and body, as streams. Version 2.1.0 is the latest stable release, with no recent updates (last published circa 2013). It wraps Node's http.createServer but adds req.createRawStream() and req.createRawBodyStream() methods to read/write raw HTTP data without parsing. Useful for proxies or debugging. Different from alternatives like raw-body by giving full control over raw socket data.","status":"maintenance","version":"2.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/substack/http-raw","tags":["javascript","http","raw","server","proxy"],"install":[{"cmd":"npm install http-raw","lang":"bash","label":"npm"},{"cmd":"yarn add http-raw","lang":"bash","label":"yarn"},{"cmd":"pnpm add http-raw","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only and does not ship ESM. ES modules import will fail.","wrong":"import createServer from 'http-raw'","symbol":"default","correct":"var createServer = require('http-raw')"},{"note":"The module exports a function directly, not as a named property.","wrong":"var createServer = require('http-raw').createServer","symbol":"createServer","correct":"var createServer = require('http-raw')"},{"note":"Method added to the request object inside the server callback. Not exported from the module directly.","wrong":null,"symbol":"req.createRawStream","correct":"var stream = req.createRawStream()"}],"quickstart":{"code":"var createServer = require('http-raw');\nvar through = require('through');\n\nvar server = createServer(function (req, res) {\n    if (req.method === 'GET') {\n        res.end('beep boop\\n');\n    } else {\n        var bs = req.createRawBodyStream();\n        bs.write('HTTP/1.1 200 OK\\r\\n\\r\\n');\n        bs.pipe(upper()).pipe(bs);\n    }\n});\nserver.listen(7000);\n\nfunction upper () {\n    return through(function (buf) {\n        this.emit('data', String(buf).toUpperCase());\n    });\n}","lang":"javascript","description":"Shows how to create an http-raw server, handle GET and other methods, and use a raw body stream to echo back uppercased data."},"warnings":[{"fix":"Use req.createRawBodyStream() instead if you only need the body after headers.","message":"req.createRawStream() emits the entire raw request including headers; data may contain binary and be large.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure you write correctly formatted HTTP data when using raw streams.","message":"Streams returned are not parsed; writing invalid HTTP can cause client errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using http.createServer with raw body parsing libraries like raw-body for active maintenance.","message":"Package has not been updated since 2013; may have vulnerabilities or incompatibilities with modern Node versions.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.1.0':21 '2013':34 'add':41 'altern':60 'bodi':17,64 'circa':33 'control':68 'creat':4 'data':13,50,72 'debug':57 'differ':58 'expos':9 'full':67 'give':66 'header':15 'http':2,6,49,74 'http-raw':1 'http.createserver':39 'includ':14 'javascript':73 'last':31 'latest':24 'like':61 'method':45 'node':37 'pars':52 'proxi':55,77 'publish':32 'raw':3,11,48,63,70,75 'raw-bodi':62 'read/write':47 'recent':29 'releas':26 'req.createrawbodystream':44 'req.createrawstream':42 'request':12 'server':7,76 'socket':71 'stabl':25 'stream':19 'updat':30 'use':53 'version':20 'without':51 'wrap':36","created_at":"2026-06-04T18:51:34.297996+00:00","updated_at":"2026-06-04T18:51:34.297996+00:00","problems":[{"fix":"Use var createServer = require('http-raw'); (no destructuring).","cause":"Trying to import the module using ES module syntax or destructuring require incorrectly.","error":"createServer is not a function"},{"fix":"Make sure to create the server with require('http-raw') instead of require('http').","cause":"Using the method on a request object from a standard http.createServer (not http-raw).","error":"req.createRawStream is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/substack/http-raw","github":"git://github.com/substack/http-raw","docs":null,"changelog":null,"pypi":null,"npm":"http-raw","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}