UNPKG

motion

Version:

motion - moving development forward

75 lines (74 loc) 4.87 kB
{ "_args": [ [ "http-browserify@https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "/Users/nw/flint/packages/flint" ] ], "_from": "http-browserify@>=1.3.2 <2.0.0", "_id": "http-browserify@1.7.0", "_inCache": true, "_location": "/http-browserify", "_phantomChildren": {}, "_requested": { "name": "http-browserify", "raw": "http-browserify@https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "rawSpec": "https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "scope": null, "spec": "https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "type": "remote" }, "_requiredBy": [ "/node-libs-browser" ], "_resolved": "https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "_shasum": "33795ade72df88acfbfd36773cefeda764735b20", "_shrinkwrap": null, "_spec": "http-browserify@https://registry.npmjs.org/http-browserify/-/http-browserify-1.7.0.tgz", "_where": "/Users/nw/flint/packages/flint", "author": { "email": "mail@substack.net", "name": "James Halliday", "url": "http://substack.net" }, "browserify": "index.js", "bugs": { "url": "https://github.com/substack/http-browserify/issues" }, "dependencies": { "Base64": "~0.2.0", "inherits": "~2.0.1" }, "description": "http module compatability for browserify", "devDependencies": { "ecstatic": "~0.1.6", "tape": "~2.3.2" }, "directories": { "example": "example", "lib": ".", "test": "test" }, "homepage": "https://github.com/substack/http-browserify#readme", "keywords": [ "browser", "browserify", "compatible", "http", "meatless" ], "license": "MIT/X11", "main": "index.js", "name": "http-browserify", "optionalDependencies": {}, "readme": "# http-browserify\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\n# example\n\n``` js\nvar http = require('http');\n\nhttp.get({ path : '/beep' }, function (res) {\n var div = document.getElementById('result');\n div.innerHTML += 'GET /beep<br>';\n \n res.on('data', function (buf) {\n div.innerHTML += buf;\n });\n \n res.on('end', function () {\n div.innerHTML += '<br>__END__';\n });\n});\n```\n\n# http methods\n\nvar http = require('http');\n\n## var req = http.request(opts, cb)\n\nwhere `opts` are:\n\n* `opts.method='GET'` - http method verb\n* `opts.path` - path string, example: `'/foo/bar?baz=555'`\n* `opts.headers={}` - as an object mapping key names to string or Array values\n* `opts.host=window.location.host` - http host\n* `opts.port=window.location.port` - http port\n* `opts.responseType` - response type to set on the underlying xhr object\n\nThe callback will be called with the response object.\n\n## var req = http.get(options, cb)\n\nA shortcut for\n\n``` js\noptions.method = 'GET';\nvar req = http.request(options, cb);\nreq.end();\n```\n\n# request methods\n\n## req.setHeader(key, value)\n\nSet an http header.\n\n## req.getHeader(key)\n\nGet an http header.\n\n## req.removeHeader(key)\n\nRemove an http header.\n\n## req.write(data)\n\nWrite some data to the request body.\n\nIf only 1 piece of data is written, `data` can be a FormData, Blob, or\nArrayBuffer instance. Otherwise, `data` should be a string or a buffer.\n\n## req.end(data)\n\nClose and send the request body, optionally with additional `data` to append.\n\n# response methods\n\n## res.getHeader(key)\n\nReturn an http header, if set. `key` is case-insensitive.\n\n# response attributes\n\n* res.statusCode, the numeric http response code\n* res.headers, an object with all lowercase keys\n\n# compatibility\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\n# protip\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\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install http-browserify\n```\n\n# license\n\nMIT\n", "readmeFilename": "readme.markdown", "repository": { "type": "git", "url": "git+ssh://git@github.com/substack/http-browserify.git" }, "scripts": { "test": "tape test/*.js" }, "version": "1.7.0" }