{"name":"teeny-request","version":"10.1.4","keywords":["request","node-fetch","fetch"],"author":{"name":"fhinkel"},"license":"Apache-2.0","_id":"teeny-request@10.1.4","maintainers":[{"name":"justinbeckwith","email":"justin.beckwith@gmail.com"},{"name":"fhinkel","email":"fhinkel@vt.edu"},{"name":"kinwa91","email":"kinwa91@msn.com"},{"name":"google-wombot","email":"node-team-npm+wombot@google.com"}],"homepage":"https://github.com/googleapis/google-cloud-node/tree/main/core/packages/teeny-request","bugs":{"url":"https://github.com/googleapis/google-cloud-node/issues"},"nyc":{"exclude":["build/test"]},"dist":{"shasum":"2d70ab1f387cd12afd1e1f8896fefa33becc513a","tarball":"http://registry-npm.ywwl.com/teeny-request/download/teeny-request-10.1.4.tgz","fileCount":12,"integrity":"sha512-R1Cg4Vu0UULeDfHL/kjABLaTW++9yD/B6n2g48y5dJ04hsEaxcfmAqbNDzNsbqAYJyIpZafjklLG9YxRu9uzOg==","signatures":[{"sig":"MEUCIGadSbsKDGwEhde1fzzMRodwl6S8bdtsWDtmoqaV4lxoAiEA+dGNl9JUJZAXSM5FfgegtySobqegSTSfyyI/YuXQNjg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55111,"size":15122,"noattachment":false,"key":"/teeny-request/-/teeny-request-10.1.4.tgz"},"main":"./build/src/index.js","types":"./build/src/index.d.ts","engines":{"node":">=18"},"gitHead":"6b9fd1af346a20479615704d40435f6ae0ecfba6","scripts":{"fix":"gts fix","docs":"jsdoc -c .jsdoc.js","lint":"gts check","test":"c8 mocha build/test","clean":"gts clean","compile":"tsc -p .","prepare":"npm run compile","pretest":"npm run compile","precompile":"gts clean","system-test":"echo no system test","samples-test":"echo no samples"},"_npmUser":{"name":"google-wombot","email":"node-team-npm+wombot@google.com"},"repository":{"url":"git+https://github.com/googleapis/google-cloud-node.git","type":"git","directory":"core/packages/teeny-request"},"_npmVersion":"11.8.0","description":"Like request, but smaller.","directories":{},"_nodeVersion":"24.13.1","dependencies":{"node-fetch":"^3.3.2","stream-events":"^1.0.5","http-proxy-agent":"^7.0.0","https-proxy-agent":"^7.0.1"},"_hasShrinkwrap":false,"devDependencies":{"c8":"^10.1.3","gts":"^6.0.2","nock":"^14.0.1","jsdoc":"^4.0.4","mocha":"^11.1.0","sinon":"^19.0.2","codecov":"^3.8.3","typescript":"^5.7.3","jsdoc-fresh":"^5.0.0","@types/mocha":"^10.0.10","@types/sinon":"^17.0.3","jsdoc-region-tag":"^3.0.0","@types/node-fetch":"^2.6.12","@babel/plugin-proposal-private-methods":"^7.18.6"},"_npmOperationalInternal":{"tmp":"tmp/teeny-request_10.1.4_1784847012092_0.38889629947821036","host":"s3://npm-registry-packages-npm-production"},"readme":"[![Build Status](https://travis-ci.org/googleapis/teeny-request.svg?branch=master)](https://travis-ci.org/googleapis/teeny-request)\n\n**_THIS REPOSITORY AND PACKAGE WILL BE DEPRECATED IN JULY 2024. RELEVANT FUNCTIONALITIES HAVE BEEN MOVED TO [GOOGLEAPIS/GAXIOS](https://github.com/googleapis/gaxios)_**\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":1784847012235,"_cnpm_publish_time":1784847012235,"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"}}