{ "name": "http-browserify", "version": "0.1.11", "description": "http module compatability for browserify", "main": "index.js", "browserify": "index.js", "directories": { "lib": ".", "example": "example", "test": "test" }, "dependencies": { "concat-stream": "0.0.8" }, "devDependencies": { "ecstatic": "~0.1.6" }, "repository": { "type": "git", "url": "http://github.com/substack/http-browserify.git" }, "keywords": [ "http", "browserify", "compatible", "meatless", "browser" ], "author": { "name": "James Halliday", "email": "mail@substack.net", "url": "http://substack.net" }, "license": "MIT/X11", "engine": { "node": ">=0.4" }, "readme": "http-browserify\n===============\n\nThe\n[http](http://nodejs.org/docs/v0.4.10/api/all.html#hTTP) module from node.js,\nbut for browsers.\n\nWhen you `require('http')` in\n[browserify](http://github.com/substack/node-browserify),\nthis module will be loaded.\n\nexample\n=======\n\n````javascript\nvar http = require('http');\n\nhttp.get({ path : '/beep' }, function (res) {\n var div = document.getElementById('result');\n div.innerHTML += 'GET /beep
';\n \n res.on('data', function (buf) {\n div.innerHTML += buf;\n });\n \n res.on('end', function () {\n div.innerHTML += '
__END__';\n });\n});\n````\n\nhttp methods\n============\n\nvar http = require('http');\n\nvar req = http.request(options, cb)\n-----------------------------------\n\n`options` can have:\n\n* method\n* path\n* headers={}, as an object mapping key names to string or Array values\n* host=window.location.host\n* port=window.location.port\n\nThe callback will be called with the response object.\n\nvar req = http.get(options, cb)\n-------------------------------\n\nA shortcut for\n\n````javascript\noptions.method = 'GET';\nvar req = http.request(options, cb);\nreq.end();\n````\n\nrequest methods\n===============\n\nreq.setHeader(key, value)\n-------------------------\n\nSet an http header.\n\nreq.write(data)\n---------------\n\nWrite some data to the request body.\n\nreq.end(data)\n-------------\n\nClose and send the request body, optionally with additional `data` to append.\n\nresponse methods\n================\n\nres.getHeader(key)\n------------------\n\nReturn an http header, if set. `key` is case-insensitive.\n\nresponse attributes\n===================\n\n* res.statusCode, the numeric http response code\n* res.headers, an object with all lowercase keys\n\nresponse events\n---------------\n\n* data\n* end\n* error\n\ncompatibility\n=============\n\nThis module has been tested and works with:\n\n* Internet Explorer 5.5, 6, 7, 8, 9\n* Firefox 3.5\n* Chrome 7.0\n* Opera 10.6\n* Safari 5.0\n\nMultipart streaming responses are buffered in all versions of Internet Explorer\nand are somewhat buffered in Opera. In all the other browsers you get a nice\nunbuffered stream of `\"data\"` events when you send down a content-type of\n`multipart/octet-stream` or similar.\n\nprotip\n======\n\nYou can do:\n\n````javascript\nvar bundle = browserify({\n require : { http : 'http-browserify' }\n});\n````\n\nin order to map \"http-browserify\" over `require('http')` in your browserified\nsource.\n", "readmeFilename": "readme.markdown", "bugs": { "url": "https://github.com/substack/http-browserify/issues" }, "_id": "http-browserify@0.1.11", "dist": { "shasum": "e8e9ce7e3045711f05a106423b8860ec404c20be" }, "_from": "http-browserify@0.1.11", "_resolved": "https://registry.npmjs.org/http-browserify/-/http-browserify-0.1.11.tgz" }