{"dist":{"shasum":"9caf07513fd6023ba804a532270597142dace4f8","tarball":"https://registry.npmjs.org/http-raw/-/http-raw-1.0.0.tgz","integrity":"sha512-BCstnES3l6krbsh7vTwON13skK14TulyQ9GEwI5/Z0LLT7BYa2l6DMD+XdrWLuHx/1MOaKQ6NW+iXvqM23JM7A==","signatures":[{"sig":"MEQCIDtjwFOeP0G08+9XgIJkPbwLkxgi0x91lSIaUQvmhxCOAiB/HvoiH+plrLMDiat37R1s4puhaXgdeRwHZJ5vBeQCew==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","name":"http-raw","author":{"url":"http://substack.net","name":"James Halliday","email":"mail@substack.net"},"readme":"# http-raw\n\nexpose the raw request data in an http server\n\n[![build status](https://secure.travis-ci.org/substack/http-raw.png)](http://travis-ci.org/substack/http-raw)\n\n# example\n\n``` js\nvar 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    }\n    else {\n        var rs = req.createRawBodyStream();\n        var ws = res.createRawStream();\n        \n        ws.write('HTTP/1.1 200 OK\\r\\n\\r\\n');\n        rs.pipe(upper()).pipe(ws)\n    }\n});\nserver.listen(7000);\n\nfunction upper () {\n    return through(function (buf) {\n        this.emit('data', String(buf).toUpperCase());\n    });\n}\n```\n\n```\n$ node example/server.js &\n$ nc localhost 7000\nPUT / HTTP/1.1\nHost: robots\n\nHTTP/1.1 200 OK\n\n\nbeep \nBEEP\nboop\nBOOP\n```\n\n# methods\n\n``` js\nvar httpRaw = require('http-raw')\n```\n\nThe http-raw api is exactly like the `http.createServer(cb)` api from core,\nexcept for the extra functions documented below that get attached to the `req`\nand `res` objects in the\n[`'request'`](http://nodejs.org/docs/latest/api/http.html#http_event_request)\nand\n[`'upgrade'`](http://nodejs.org/docs/latest/api/http.html#http_event_upgrade)\nevents.\n\n## var server = httpRaw(cb)\n\nCreate a new http server with extended raw stream functions.\n\n## var server = httpRaw.https(options, cb)\n\nCreate a new https server with extended raw stream functions.\n\n## var rs = req.createRawStream()\n\nReturn a readable stream `rs`. `rs` will emit all the raw data from the\nconnection, including the buffered header data without doing any parsing on the\ndata beforehand.\n\nTo get all the data, `req.createRawStream()` must be fired on the same tick as\nthe response callback.\n\nOn the same tick as the response handler, `s.buffers` will have all all the\nbuffer slices formatted as an array where each element is an array:\n\n``` js\n[ buffer, start, end ]\n```\n\nOn the next tick `s.buffers` gets set to undefined to it can be garbage\ncollected.\n\n## var ws = res.createRawStream()\n\nReturn a writable stream `ws` that will be written directly to the underlying\nnetwork socket without any additional framing added.\n\n## var bs = req.createRawBodyStream()\n\nReturn a readable stream `bs` like the stream returned by\n`req.createRawStream()`, but only emit the raw body data, not the headers.\n\nTo get all the data, `req.createRawBodyStream()` must be fired on the same tick\nas the response callback.\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install http-raw\n```\n\n# license\n\nMIT\n","license":"MIT","scripts":{"test":"tap test/*.js"},"_npmUser":{"name":"substack","email":"mail@substack.net"},"homepage":"https://github.com/substack/http-raw","keywords":["http","raw","server","proxy"],"repository":{"url":"git://github.com/substack/http-raw.git","type":"git"},"_npmVersion":"1.1.59","description":"expose the raw request data in an http server","directories":{"test":"test","example":"example"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"dependencies":{},"devDependencies":{"tap":"~0.3.0","request":"~2.12.0","through":"~2.1.0"},"_id":"http-raw@1.0.0","version":"1.0.0"}