{"name":"teeny-request","version":"1.1.0","description":"Like request, but smaller.","main":"index.js","scripts":{"test":"mocha build/test","compile":"tsc -p .","pretest":"npm run compile"},"repository":{"type":"git","url":"git+https://github.com/fhinkel/teeny-request.git"},"keywords":["request","node-fetch","fetch"],"author":{"name":"fhinkel"},"license":"Apache-2.0","bugs":{"url":"https://github.com/fhinkel/teeny-request/issues"},"homepage":"https://github.com/fhinkel/teeny-request#readme","dependencies":{"node-fetch":"^2.2.0"},"devDependencies":{"@types/node-fetch":"^2.1.2","@types/request":"^2.47.1","mocha":"^5.2.0","typescript":"^3.0.1"},"gitHead":"643b9a1fa6ac9ee4373b4a35b7afbae60e361b1d","_id":"teeny-request@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"fhinkel","email":"fhinkel@vt.edu"},"dist":{"integrity":"sha512-llWFLnbUo415Ry/Do6otgmxdjAZVGn/aJkuFy5RVhO5fMEl/2+jWNONJyzGcPLXSp+m0QwiWKFnZY+5ZS74pzQ==","shasum":"a37dd9595b29e6b2e4a7552fe5668f0a9a4a9cdc","tarball":"http://registry-npm.ywwl.com/teeny-request/download/teeny-request-1.1.0.tgz","fileCount":5,"unpackedSize":15437,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdby+CRA9TVsSAnZWagAADXwP/jPoxBJ7PC4M7EOEfqsw\ncYpB7plwXxnV7hHNvEFUU7rB+Vh5kQrjmhN3/Oreu5O0hhtKIMqqH/LpTB5R\nECBXmffpP1Q6jI3c9wAkpWrBR48FIcczqbLu4sOuxqoYu0IGB/Ec/AQSMg5y\nKYFE3E/ViTYhrVwtQZA5pwZ+s2pfR6XCMqmCWLz3Lq23Zd6rANcuzxFV6nR7\noZmTEoUaZ54GWfLtX+Q5DvibgOfz9T8L1tm6QmQeJQuaiJH7wuGkwiwEOlpl\nxagymtozYVQj47fpe8qR97SKenf8WF9aACEBKkE2sbTKZDtAj8va3enmcPPG\nwvfSIh3ax61AnSd68fjnIBPX8yMRHTqUIo5ecGmBB10110Tl7fvOKBV8smNM\nExVxg1JdN2w4sHX09G0E6AmPOxjdaHqYhe7kbHTRIjAaot+xjLWjV/vsOURi\n5GgXxu5BBaqwSy6zlxmDAWR0KiE6w52yyH6Qpr+UcbRwxjPhTOdgtvbEVLwU\nqbaCmZv38ysIuhgviT7ao8TwJNZZUAw3pyyqbLaNSWcYbzIYYHOnt2O+0I8d\nvsVM7hOfzm3iPEhL0nDBrU69DSdO++SP+LVegkQBRSA6T1zWVYgzAvL7b4Ss\nH/YCLech8iyTvpSlDzQXBClIwmbytHPsmy0zY5OEWNJGqIhxbt/MquMgSdYU\nnntE\r\n=RozJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLAJIoMU/UGDO6AwaFZ6pH3eSHisYFOc2Vcy9BFkaHywIhAJbNGW9schJSKWFOYlbktSNv/ew0NJ8bky5zo69DLAnI"}],"size":5771,"noattachment":false,"key":"/teeny-request/-/teeny-request-1.1.0.tgz"},"maintainers":[{"name":"fhinkel","email":"fhinkel@vt.edu"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/teeny-request_1.1.0_1534442685454_0.7681324062825203"},"_hasShrinkwrap":false,"readme":"[![Build Status](https://travis-ci.org/googleapis/teeny-request.svg?branch=master)](https://travis-ci.org/googleapis/teeny-request)\n\n# teeny-request \n\nLike `request`, but much smaller - and with less options. Uses `node-fetch` under the hood. \nPop it in where you would use `request`. Improves load and parse time of modules. \n\n```js\nconst request = require('teeny-request').teenyRequest;\n\nrequest({uri: 'http://ip.jsontest.com/'}, function (error, response, body) {\n  console.log('error:', error); // Print the error if one occurred\n  console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received\n  console.log('body:', body); // Print the JSON.\n});\n```\n\nFor TypeScript, you can use `@types/request`. \n\n```ts\nimport {teenyRequest as request} from 'teeny-request';\nimport * as r from 'request'; // Only for type declarations\n\nrequest({uri: 'http://ip.jsontest.com/'}, (error: any, response: r.Response, body: any) => {\n  console.log('error:', error); // Print the error if one occurred\n  console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received\n  console.log('body:', body); // Print the JSON.\n});\n```\n\n\n\n## teenyRequest(options, callback)\n\nOptions are limited to the following \n\n* uri\n* method, default GET\n* headers\n* json\n* qs\n* useQuerystring\n* timeout in ms\n* gzip\n* proxy\n\n```ts\nrequest({uri:'http://service.com/upload', method:'POST', json: {key:'value'}}, function(err,httpResponse,body){ /* ... */ })\n```\n\nThe callback argument gets 3 arguments:\n\n * An error when applicable (usually from http.ClientRequest object)\n * A response object with statusCode, a statusMessage, and a body\n * The third is the response body (JSON object)\n\n## defaults(options)\n\nSet default options for every `teenyRequest` call.\n\n```ts\nlet defaultRequest = teenyRequest.defaults({timeout: 60000});\n      defaultRequest({uri: 'http://ip.jsontest.com/'}, function (error, response, body) {\n            assert.ifError(error);\n            assert.strictEqual(response.statusCode, 200);\n            console.log(body.ip);\n            assert.notEqual(body.ip, null);\n            \n            done();\n        });\n```        \n\n## Proxy environment variables\nIf environment variables `HTTP_PROXY`, `HTTPS_PROXY`, or `NO_PROXY` are set, they are respected.\n\n## Building with Webpack 4+\nSince 4.0.0, Webpack uses `javascript/esm` for `.mjs` files which handles ESM more strictly compared to `javascript/auto`. If you get the error `Can't import the named export 'PassThrough' from non EcmaScript module`, please add the following to your Webpack config:\n\n```js\n{\n    test: /\\.mjs$/,\n    type: 'javascript/auto',\n},\n```\n\n## Motivation\n`request` has a ton of options and features and is accordingly large. Requiring a module incurs load and parse time. For\n`request`, that is around 600ms.\n\n![Load time of request measured with require-so-slow](https://user-images.githubusercontent.com/101553/44694187-20357700-aa3a-11e8-9116-b8ae794cbc27.png)\n\n`teeny-request` doesn't have any of the bells and whistles that `request` has, but is so much faster to load. If startup time is an issue and you don't need much beyond a basic GET and POST, you can use `teeny-request`.\n\n## Thanks\nSpecial thanks to [billyjacobson](https://github.com/billyjacobson) for suggesting the name. Please report all bugs to them. Just kidding. Please open issues.\n","publish_time":1534442685613,"_cnpm_publish_time":1534442685613,"dist-tags":{"latest":"11.1.1","legacy-10":"7.2.0","legacy-12":"8.0.3","legacy-14":"9.0.0","legacy-18":"10.1.4","legacy-8":"6.0.2"}}