{"name":"centra","version":"2.4.1","description":"The core lightweight HTTP client for Node","main":"createRequest.js","scripts":{"test":"node test.js","prepublishOnly":"npm test"},"repository":{"type":"git","url":"git+https://github.com/ethanent/centra.git"},"keywords":["http","https","request","fetch","url","lightweight"],"author":{"name":"Ethan Davis","url":"https://ethanent.me"},"license":"MIT","bugs":{"url":"https://github.com/ethanent/centra/issues"},"homepage":"https://github.com/ethanent/centra","devDependencies":{"retra":"^1.0.2","whew":"^1.1.3"},"gitHead":"82ce094255c7377e51f1e6db4e3a9756947bd41a","_id":"centra@2.4.1","_nodeVersion":"12.8.0","_npmVersion":"6.10.2","dist":{"integrity":"sha512-5PZn+4aJzVJbO/T+p/0cXpCJ9Us6INkNwnI/Sn7pd6uliImWzjKJSw65IgI5+L+O95VkVaIO4K7pHURc0ZnjWA==","shasum":"63fb6f0f457d72fb4f55a3c6f5bd68855c280e63","tarball":"http://registry-npm.ywwl.com/centra/download/centra-2.4.1.tgz","fileCount":7,"unpackedSize":9904,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe4p4rCRA9TVsSAnZWagAAKy8P+QFB1WKeXtADoG99zJpV\nNc3lNlzBGT3Q184QmYohjLfLHSIPhmDfDVWQGrhH8EdqpoAVojpCfDJyNlrc\nra7WgazPG94K/mZVKgh6xqyUu06e98FuKLTQG23/bcrFuw6R1nuv+y6atv22\n+V63Cq8NLKeXuhOl278zVtOWekiHZLeyq/mXRFUP3XXwuF+eWGVoNVAp7krb\nhfyN51YfeqR9bUxLt8JqutT6QEoYCG574CLCCiVgluvDHU2yFu3h5baR5HAZ\nGCYntB2OvUawNAuAZ17wBXkBPvCYyOEvM9pm7vP1K/Ya5GmKfjDvkoXxqq1Z\n6QmpXKOEZ/7GVHgPz+rvFrosjpolxiEdt4sNCd0Own3NbBzp3qjS8bCbK9jV\nqydqth8tq98kMdkPPd+3jijpcb83uSnxrUmNJqdTuaSRmQv3wAtv2uAZX1+C\nO39UwvSXUvgHUOhjN2oJjqdUAjyzMjPhg7m+yFqXCxGOCSGpGc3Zm8vLTKL4\ngr3WeYIeDDfgTAvlrCQ9ImdRYR/3K5QbW3+h/qQLnF6k5aOtH+xck3FmdQS7\n4s+3t+ETQzF9M/QWNB888tvYjfRoKtjBzEVZrwCKLjsKOqfjtb/MQcQZbIYb\nQ5B/6MbABpzBZJ9QeRR41G5xHjd+4o5k3+79Co2dDUWLc1qqX+XpHJh53P51\n0KDh\r\n=WebO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCHwC9k77lJrxKkqhQczYA1AFJeEWRQNcv6LC4AmdtVAMCIDLn2Q6ydpqGvEH83FF67kYOOQ4ExSptErbjZPa7w/P1"}],"size":4066,"noattachment":false,"key":"/centra/-/centra-2.4.1.tgz"},"maintainers":[{"name":"ethan_","email":"futuristiccake@gmail.com"}],"_npmUser":{"name":"ethan_","email":"futuristiccake@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/centra_2.4.1_1591909930568_0.054457051540592216"},"_hasShrinkwrap":false,"readme":"<p align=\"center\" style=\"text-align: center;\"><img src=\"https://github.com/ethanent/centra/blob/master/media/centraLogo.png?raw=true\" width=\"400\"/></p>\n\n> The core lightweight HTTP client for Node\n\n[GitHub](https://github.com/ethanent/centra) | [NPM](https://npmjs.com/package/centra)\n\n## Install\n\n```shell\nnpm i centra\n```\n\n## Why centra?\n\ncentra is the best request library for developers; it provides a number of extremely useful features while still being one of the most lightweight Node.js HTTP client libraries available.\n\n## Use centra!\n\nFirst, require the library.\n\n```js\nconst c = require('centra')\n```\n\nThen let's make a request in an async function!\n\n```js\n;(async () => {\n\tconst res = await c('https://example.com').send()\n\n\tconsole.log(await res.text())\n})()\n```\n\n## More advanced usage\n\n### Send data in a JSON body\n\n```js\nc('https://example.com/nonexistentJSONAPI', 'POST').body({\n\t'name': 'Ethan'\n}, 'json').send().then((res) => {\n\t/*...*/\n})\n```\n\n### Send data in a form body\n\n```js\nc('https://example.com/nonexistentJSONAPI', 'POST').body({\n\t'name': 'Ethan'\n}, 'form').send().then((res) => {\n\t/*...*/\n})\n```\n\n### Set query string parameters\n\nOne at a time:\n\n```js\nc('https://example.com/user').query('id', 'u1817760').send().then((res) => {\n\t/*...*/\n})\n```\n\nMany at a time:\n\n```js\nc('https://example.com/user').query({\n\t'id', 'u1817760',\n\t'name': 'Ethan'\n}).send().then((res) => {\n\t/*...*/\n})\n```\n\n### Set a request timeout\n\n```js\nc('https://example.com').timeout(2000).send().then((res) => {\n\t// Success!\n}).catch((err) => {\n\t// Has the request timed out?\n})\n```\n\n### Stream a request's response\n\nIn this example, the [stream](https://nodejs.org/api/stream.html) is piped to a file:\n\n```js\n// require the fs module beforehand\n\nc('https://example.com').stream().send().then((stream) => stream.pipe(fs.createWriteStream(path.join(__dirname, 'logo.png'))))\n```\n\n### Follow redirects\n\n```js\nc('https://example.com/').followRedirects(5).send()\n```\n\n### Switch paths on the fly\n\n```js\nc('https://example.com/test').path('/hello').send()\n\n// This will make a request to https://example.com/test/hello\n```\n\n### Specify request headers\n\nOne at a time:\n\n```js\nc('https://example.com').header('Content-Type', 'application/json').send()\n```\n\nMany at a time:\n\n```js\nc('https://example.com').header({\n\t'Content-Type': 'application/json',\n\t'X-Connecting-With': 'centra'\n}).send()\n```\n\n### Modify core HTTP request options\n\nSee [http.request](https://nodejs.org/dist/latest-v10.x/docs/api/http.html#http_http_request_url_options_callback)'s options for more information about core HTTP request options.\nLet's change our localAddress as an example.\n\n```js\nc('https://example.com').option('localAddress', '127.0.0.2').send()\n```\n\n### Accept compressed responses\n\n```js\nc('https://example.com').compress().send()\n\n// This will cause centra to accept compressed content from the server. (gzip and deflate are currently supported)\n```\n","publish_time":1591909930681,"_cnpm_publish_time":1591909930681,"dist-tags":{"latest":"2.7.0"}}