{"_id":"turbo-http","_rev":"235552","name":"turbo-http","description":"Blazing fast low level http server","dist-tags":{"latest":"0.3.2"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"time":{"modified":"2023-03-24T16:23:35.000Z","created":"2017-02-13T15:19:23.893Z","0.3.2":"2019-03-18T13:04:48.465Z","0.3.0":"2018-03-18T19:19:45.478Z","0.2.0":"2018-03-06T09:37:16.938Z","0.1.1":"2018-03-02T14:45:58.853Z","0.0.0":"2017-02-13T15:19:23.893Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/turbo-http.git"},"versions":{"0.3.2":{"name":"turbo-http","version":"0.3.2","description":"Blazing fast low level http server","main":"index.js","dependencies":{"http-parser-js":"^0.4.11","turbo-net":"^1.4.0"},"devDependencies":{"autocannon":"^2.4.1","chalk":"^2.4.1","cli-table":"^0.3.1","express":"^4.16.3","fastify":"^1.4.0","hapi":"^17.4.0","minimist":"^1.2.0","ora":"^2.1.0","polka":"^0.4.0","rayo":"^0.5.7","standard":"^11.0.0","tape":"^4.9.0"},"scripts":{"pretest":"npm run lint","bench":"node ./benchmarks","test":"tape test/*.js","lint":"standard"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/turbo-http.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/turbo-http/issues"},"homepage":"https://github.com/mafintosh/turbo-http","gitHead":"cacb2236155bbbf0d68407d673f10336b125debe","_id":"turbo-http@0.3.2","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"184a95dd0b8630d8e2e407ca1f0ddbdf69bc1838","size":5929,"noattachment":false,"key":"/turbo-http/-/turbo-http-0.3.2.tgz","tarball":"http://name.csiicloud.com:7001/turbo-http/download/turbo-http-0.3.2.tgz"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/turbo-http_0.3.2_1552914288307_0.39492833155523943"},"_hasShrinkwrap":false,"publish_time":1552914288465,"_cnpm_publish_time":1552914288465,"_cnpmcore_publish_time":"2021-12-16T23:46:21.823Z"},"0.3.0":{"name":"turbo-http","version":"0.3.0","description":"Blazing fast low level http server","main":"index.js","dependencies":{"http-parser-js":"^0.4.11","turbo-net":"^1.4.0"},"devDependencies":{"standard":"^11.0.0"},"scripts":{"test":"standard"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/turbo-http.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/turbo-http/issues"},"homepage":"https://github.com/mafintosh/turbo-http","gitHead":"274e709f7d8abb8d34d954a23cca782c694bcaf2","_id":"turbo-http@0.3.0","_npmVersion":"5.6.0","_nodeVersion":"9.7.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"c4673c78e764fca260c197f9f33047f5cb3d3a3e","size":5251,"noattachment":false,"key":"/turbo-http/-/turbo-http-0.3.0.tgz","tarball":"http://name.csiicloud.com:7001/turbo-http/download/turbo-http-0.3.0.tgz"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/turbo-http_0.3.0_1521400785395_0.5662035277705011"},"_hasShrinkwrap":false,"publish_time":1521400785478,"_cnpm_publish_time":1521400785478,"_cnpmcore_publish_time":"2021-12-16T23:46:22.050Z"},"0.2.0":{"name":"turbo-http","version":"0.2.0","description":"Blazing fast low level http server","main":"index.js","dependencies":{"http-parser-js":"^0.4.10","turbo-net":"^1.2.1"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/mafintosh/turbo-http.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/turbo-http/issues"},"homepage":"https://github.com/mafintosh/turbo-http","gitHead":"45fb148dd52d71ab9cb0069c8c076a01328337f9","_id":"turbo-http@0.2.0","_npmVersion":"5.6.0","_nodeVersion":"9.6.1","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"ba4b5810206a17c24948bd117b998471ef5ed22e","size":4954,"noattachment":false,"key":"/turbo-http/-/turbo-http-0.2.0.tgz","tarball":"http://name.csiicloud.com:7001/turbo-http/download/turbo-http-0.2.0.tgz"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/turbo-http_0.2.0_1520329036867_0.14714300819635073"},"_hasShrinkwrap":false,"publish_time":1520329036938,"_cnpm_publish_time":1520329036938,"_cnpmcore_publish_time":"2021-12-16T23:46:22.218Z"},"0.1.1":{"name":"turbo-http","version":"0.1.1","description":"Blazing fast low level http server","main":"index.js","dependencies":{"http-parser-js":"^0.4.10","turbo-net":"^1.2.1"},"devDependencies":{},"repository":{"type":"git","url":"git+https://github.com/mafintosh/turbo-http.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/turbo-http/issues"},"homepage":"https://github.com/mafintosh/turbo-http","gitHead":"4b17cda080639f3326d45a4fa38ff0435a3b59dd","_id":"turbo-http@0.1.1","_npmVersion":"5.6.0","_nodeVersion":"10.0.0-pre","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"9d48fc91f2cb3c813fcb8ee24747a6cf60fcb352","size":4941,"noattachment":false,"key":"/turbo-http/-/turbo-http-0.1.1.tgz","tarball":"http://name.csiicloud.com:7001/turbo-http/download/turbo-http-0.1.1.tgz"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/turbo-http_0.1.1_1520001958784_0.8559962662289875"},"_hasShrinkwrap":false,"publish_time":1520001958853,"_cnpm_publish_time":1520001958853,"_cnpmcore_publish_time":"2021-12-16T23:46:22.468Z"},"0.0.0":{"name":"turbo-http","version":"0.0.0","description":"","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"author":"","license":"MIT","_id":"turbo-http@0.0.0","_shasum":"eef713dce2b510bcb23fd7440d8a3e3d71332b69","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"ricardofbarros","email":"ricardofbarros@hotmail.com"},"dist":{"shasum":"eef713dce2b510bcb23fd7440d8a3e3d71332b69","size":251,"noattachment":false,"key":"/turbo-http/-/turbo-http-0.0.0.tgz","tarball":"http://name.csiicloud.com:7001/turbo-http/download/turbo-http-0.0.0.tgz"},"maintainers":[{"name":"mafintosh","email":""},{"name":"npm:mafintosh","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/turbo-http-0.0.0.tgz_1486999162039_0.7792387055233121"},"directories":{},"publish_time":1486999163893,"_hasShrinkwrap":false,"_cnpm_publish_time":1486999163893,"_cnpmcore_publish_time":"2021-12-16T23:46:22.635Z"}},"readme":"# turbo-http\n\nA low level http library for Node.js based on [turbo-net](https://github.com/mafintosh/turbo-net)\n\n```\nnpm i turbo-http\n```\n\n[![build status](https://travis-ci.org/mafintosh/turbo-http.svg?branch=master)](https://travis-ci.org/mafintosh/turbo-http)\n\nWIP, this module is already *really* fast but there are some HTTP features\nmissing and easy performance gains to be had. :D :D :D\n\nOn my laptop I can serve simple hello world payloads at around 100k requests/seconds compared to 10k requests/second using node core.\n\n## Usage\n\n``` js\nconst turbo = require('turbo-http')\n\nconst server = turbo.createServer(function (req, res) {\n  res.setHeader('Content-Length', '11')\n  res.write(Buffer.from('hello world'))\n})\n\nserver.listen(8080)\n```\n\n## API\n\n#### `server = turbo.createServer([onrequest])`\n\nCreate a new http server. Inherits from [the turbo-net tcp server](https://github.com/mafintosh/turbo-net#server--turbocreateserveroptions-onsocket)\n\n#### `server.on('request', req, res)`\n\nEmitted when a new http request is received.\n\n#### `res.statusCode = code`\n\nSet the http status\n\n#### `res.setHeader(name, value)`\n\nSet a http header\n\n#### `res.write(buf, [length], [callback])`\n\nWrite a buffer. When the callback is called, the buffer\nhas been *completely* flushed to the underlying socket and is safe to\nreuse for other purposes\n\n#### `res.writev(buffers, [lengths], [callback])`\n\nWrite more that one buffer at once.\n\n#### `res.end([buf], [length], [callback]`)\n\nEnd the request. Only needed if you do not provide a `Content-Length`.\n\n#### `req.url`\n\nRequest url\n\n#### `req.method`\n\nRequest method\n\n#### `req.socket`\n\nRequest [turbo-net](https://github.com/mafintosh/turbo-net) socket\n\n#### `value = req.getHeader(name)`\n\nGet a request header.\n\n#### `headers = req.getAllHeaders()`\n\nGet all request headers as a map.\n\n#### `req.ondata(buffer, start, length)`\n\nCalled when there is data read. If you use the buffer outside of this function\nyou should copy it.\n\n#### `req.onend()`\n\nCalled when the request is fully read.\n\n\n## Benchmarks\n\nComparing `turbo-http` to other frameworks is like comparing oranges to apples.\n`turbo-http` could be thought of as a replacement of Node's native [http](https://nodejs.org/api/http.html) module, while all available frameworks actually use it.\n\nBenchmark it:\n- `clone this repo`,\n- `npm i`\n- `npm run bench`\n\nBenchmark averages are taken after one warm-up round.\n\n&nbsp;        | Requests/s | Latency | Throughput/Mb\n------------- | ---------- | ------- | --------------\nturbo-http.js | 32592      | 3.03    | 2.43\nbare-node.js  | 18396      | 5.32    | 1.98\nrayo.js       | 16249.6    | 6.03    | 1.77\npolka.js      | 15802.4    | 6.2     | 1.71\nfastify.js    | 15141.6    | 6.47    | 2.26\nexpress.js    | 13408.8    | 7.31    | 1.46\nhapi.js       | 9675.6     | 10.15   | 1.42\n\n> **Note:** Nevermind these numbers, this benchmark was run on a slow computer and the above table is for illustrative purposes only.\n\nOptionally, you may also define your test's parameters:\n```\n$> npm run bench -- -u http://localhost:5050 -c 100 -p 10 -d 5\n```\n* `-u` (_url_) -Defaults to `http://localhost:5050`\n* `-c` (_connections_) -Defaults to `100`\n* `-p` (_pipelines_) -Defaults to `10`\n* `-d` (_duration_) -Defaults to `5` (seconds)\n\n\n## Acknowledgements\n\nThis project was kindly sponsored by [nearForm](http://nearform.com).\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/turbo-http","bugs":{"url":"https://github.com/mafintosh/turbo-http/issues"},"license":"MIT"}