{"_id":"iso-stream-http","_rev":"4573371","name":"iso-stream-http","description":"Isomorphic/Universal implementation of the node http module","dist-tags":{"latest":"0.1.2"},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"time":{"modified":"2026-04-10T15:34:42.000Z","created":"2019-03-14T16:39:48.652Z","0.1.2":"2019-03-26T15:52:47.398Z","0.1.1":"2019-03-14T17:29:35.363Z","0.1.0":"2019-03-14T16:39:48.652Z"},"users":{},"author":{"name":"Hugo Dias"},"repository":{"type":"git","url":"https://github.com/hugomrdias/iso-stream-http.git"},"versions":{"0.1.2":{"name":"iso-stream-http","version":"0.1.2","description":"Isomorphic/Universal implementation of the node http module","main":"index.js","repository":{"type":"git","url":"https://github.com/hugomrdias/iso-stream-http.git"},"browser":{"./index.js":"./index.browser.js"},"scripts":{"test-browser":"airtap --loopback airtap.local -- test/browser/*.js","test-browser-local":"airtap --no-instrument --local 8080 -- test/browser/*.js"},"author":{"name":"Hugo Dias"},"license":"MIT","bugs":{"url":"https://github.com/hugomrdias/iso-stream-http/issues"},"homepage":"https://github.com/hugomrdias/iso-stream-http#readme","keywords":["http","stream","streaming","fetch","node http"],"dependencies":{"builtin-status-codes":"^3.0.0","inherits":"^2.0.1","readable-stream":"^3.1.1"},"devDependencies":{"airtap":"^0.1.0","basic-auth":"^2.0.1","brfs":"^2.0.1","cookie-parser":"^1.4.3","express":"^4.16.3","np":"^4.0.2","tape":"^4.9.0","ua-parser-js":"^0.7.18","webworkify":"^1.5.0"},"licenseText":"MIT License\n\nCopyright (c) Hugo Dias <hugomrdias@gmail.com> (hugodias.me)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"iso-stream-http@0.1.2","dist":{"shasum":"b3dfea4c9f23ff26d078d40c539cfc0dfebacd37","size":6511,"noattachment":false,"key":"/iso-stream-http/-/iso-stream-http-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/iso-stream-http/download/iso-stream-http-0.1.2.tgz"},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iso-stream-http_0.1.2_1553615567247_0.7447318839541741"},"_hasShrinkwrap":false,"publish_time":1553615567398,"_cnpm_publish_time":1553615567398,"_cnpmcore_publish_time":"2021-12-16T18:34:00.674Z"},"0.1.1":{"name":"iso-stream-http","version":"0.1.1","description":"Isomorphic/Universal implementation of the node http module","main":"index.js","repository":{"type":"git","url":"https://github.com/hugomrdias/iso-stream-http.git"},"browser":{"./index.js":"./index.browser.js"},"scripts":{"test-browser":"airtap --loopback airtap.local -- test/browser/*.js","test-browser-local":"airtap --no-instrument --local 8080 -- test/browser/*.js"},"author":{"name":"Hugo Dias"},"license":"MIT","bugs":{"url":"https://github.com/hugomrdias/iso-stream-http/issues"},"homepage":"https://github.com/hugomrdias/iso-stream-http#readme","keywords":["http","stream","streaming","fetch","node http"],"dependencies":{"builtin-status-codes":"^3.0.0","inherits":"^2.0.1","readable-stream":"^3.1.1"},"devDependencies":{"airtap":"^0.1.0","basic-auth":"^2.0.1","brfs":"^2.0.1","cookie-parser":"^1.4.3","express":"^4.16.3","np":"^4.0.2","tape":"^4.9.0","ua-parser-js":"^0.7.18","webworkify":"^1.5.0"},"licenseText":"MIT License\n\nCopyright (c) Hugo Dias <hugomrdias@gmail.com> (hugodias.me)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"iso-stream-http@0.1.1","dist":{"shasum":"f763eb63014cea781f9296073879eaec1be4f5ac","size":6506,"noattachment":false,"key":"/iso-stream-http/-/iso-stream-http-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/iso-stream-http/download/iso-stream-http-0.1.1.tgz"},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iso-stream-http_0.1.1_1552584575219_0.29015640350146965"},"_hasShrinkwrap":false,"publish_time":1552584575363,"_cnpm_publish_time":1552584575363,"_cnpmcore_publish_time":"2021-12-16T18:34:00.860Z"},"0.1.0":{"name":"iso-stream-http","version":"0.1.0","description":"Isomorphic/Universal implementation of the node http module","main":"index.js","repository":{"type":"git","url":"https://github.com/hugomrdias/iso-stream-http.git"},"browser":{"index.js":"index.browser.js"},"scripts":{"test-browser":"airtap --loopback airtap.local -- test/browser/*.js","test-browser-local":"airtap --no-instrument --local 8080 -- test/browser/*.js"},"author":{"name":"Hugo Dias"},"license":"MIT","bugs":{"url":"https://github.com/hugomrdias/iso-stream-http/issues"},"homepage":"https://github.com/hugomrdias/iso-stream-http#readme","keywords":["http","stream","streaming","fetch","node http"],"dependencies":{"builtin-status-codes":"^3.0.0","inherits":"^2.0.1","readable-stream":"^3.1.1"},"devDependencies":{"airtap":"^0.1.0","basic-auth":"^2.0.1","brfs":"^2.0.1","cookie-parser":"^1.4.3","express":"^4.16.3","tape":"^4.9.0","ua-parser-js":"^0.7.18","webworkify":"^1.5.0"},"licenseText":"MIT License\n\nCopyright (c) Hugo Dias <hugomrdias@gmail.com> (hugodias.me)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","_id":"iso-stream-http@0.1.0","dist":{"shasum":"bcab0af2ff3ab1d209778f0e265c535f9705eed6","size":6493,"noattachment":false,"key":"/iso-stream-http/-/iso-stream-http-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/iso-stream-http/download/iso-stream-http-0.1.0.tgz"},"maintainers":[{"name":"hugomrdias","email":"mail@hugodias.me"}],"_npmUser":{"name":"hugomrdias","email":"mail@hugodias.me"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iso-stream-http_0.1.0_1552581588536_0.6266495692130172"},"_hasShrinkwrap":false,"publish_time":1552581588652,"_cnpm_publish_time":1552581588652,"_cnpmcore_publish_time":"2021-12-16T18:34:01.073Z"}},"readme":"# iso-stream-http [![NPM Version](https://img.shields.io/npm/v/iso-stream-http.svg)](https://www.npmjs.com/package/iso-stream-http) [![NPM Downloads](https://img.shields.io/npm/dt/iso-stream-http.svg)](https://www.npmjs.com/package/iso-stream-http) [![NPM License](https://img.shields.io/npm/l/iso-stream-http.svg)](https://www.npmjs.com/package/iso-stream-http)\n\n\nThis module is an implementation of Node's native `http` module for the browser.\nIt tries to match Node's API and behavior as closely as possible, but some features\naren't available, since browsers don't give nearly as much control over requests.\n\nThis is heavily inspired by, and intended to replace, [stream-http](https://github.com/jhiesey/stream-http).\n\n## What does it do?\n\nIn accordance with its name, `stream-http` tries to provide data to its caller before\nthe request has completed whenever possible.\n\nAll other supported browsers support pseudo-streaming, where the data is available before\nthe request finishes, but the entire response must be held in memory. This works for both\ntext and binary data.\n\n## Usage\n\n```js\nconst { https, http, getRequest } = require('iso-stream-http');\n\nconst req = new http.request('http://localhost/unicorns');\nconst req = new https.request('https://secure/unicorns');\n\n// Detects url and returns http/https in node, just a helper function.\nconst req = new getRequest('https://secure/unicorns');\n```\n\n### Extra features compared to Node\n\n* The `message.url` property provides access to the final URL after all redirects. This\nis useful since the browser follows all redirects silently, unlike Node. It is available\nin Chrome 37 and newer, Firefox 32 and newer, and Safari 9 and newer.\n\n* The `options.withCredentials` boolean flag, used to indicate if the browser should send\ncookies or authentication information with a CORS request. Default false.\n\n* `options.requestTimeout` allows setting a timeout in millisecionds for XHR and fetch (if\nsupported by the browser). This is a limit on how long the entire process takes from\nbeginning to end. Note that this is not the same as the node `setTimeout` functions,\nwhich apply to pauses in data transfer over the underlying socket, or the node `timeout`\noption, which applies to opening the connection.\n\n### Features missing compared to Node\n\n* `http.Agent` is only a stub\n* The 'socket', 'connect', 'upgrade', and 'continue' events on `http.ClientRequest`.\n* Any operations, including `request.setTimeout`, that operate directly on the underlying\nsocket.\n* Any options that are disallowed for security reasons. This includes setting or getting\ncertain headers.\n* `message.httpVersion`\n* `message.rawHeaders` is modified by the browser, and may not quite match what is sent by\nthe server.\n* `message.trailers` and `message.rawTrailers` will remain empty.\n* Redirects are followed silently by the browser, so it isn't possible to access the 301/302\nredirect pages.\n* The `timeout` event/option and `setTimeout` functions, which operate on the underlying\nsocket, are not available. However, see `options.requestTimeout` above.\n\n## Example\n\n``` js\nhttp.get('/bundle.js', function (res) {\n\tvar div = document.getElementById('result');\n\tdiv.innerHTML += 'GET /beep<br>';\n\n\tres.on('data', function (buf) {\n\t\tdiv.innerHTML += buf;\n\t});\n\n\tres.on('end', function () {\n\t\tdiv.innerHTML += '<br>__END__';\n\t});\n})\n```\n\n## Running tests\n\nThere are two sets of tests: the tests that run in Node (found in `test/node`) and the tests\nthat run in the browser (found in `test/browser`). Normally the browser tests run on\n[Sauce Labs](http://saucelabs.com/).\n\nRunning `npm test` will run both sets of tests, but in order for the Sauce Labs tests to run\nyou will need to sign up for an account (free for open source projects) and put the\ncredentials in a [`.airtaprc` file](https://github.com/airtap/airtap/blob/master/doc/airtaprc.md).\nYou will also need to run a [Sauce Connect Proxy](https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy)\nwith the same credentials.\n\nTo run just the Node tests, run `npm run test-node`.\n\nTo run the browser tests locally, run `npm run test-browser-local` and point your browser to\nthe link shown in your terminal.\n\n## License\n\nMIT © [Hugo Dias](http://hugodias.me)\n","_attachments":{},"homepage":"https://github.com/hugomrdias/iso-stream-http#readme","bugs":{"url":"https://github.com/hugomrdias/iso-stream-http/issues"},"license":"MIT"}