{"_id":"@dossy/simple-get-promise","_rev":"1-c6de5341fe807d7f4ddfa221b6ef6d5a","name":"@dossy/simple-get-promise","dist-tags":{"latest":"3.0.0"},"versions":{"3.0.0":{"name":"@dossy/simple-get-promise","description":"Simple modern way to make http requests. Supports HTTPS, ES6, JSON and Promises","repository":{"type":"git","url":"git+ssh://git@github.com/dossy/simple-get-promise.git"},"version":"3.0.0","license":"Apache-2.0","main":"dist/get.cjs.js","jsnext:main":"dist/get.es6.js","scripts":{"prebuild":"npx eslint src test","build":"rollup -c rollup.config.js","pretest":"rollup -c rollup.config.test.js","test":"tap tmp/test-bundle.js","prepare":"npm test && npm run build","watch":"nodemon --watch src --watch test --exec \"npm test\""},"devDependencies":{"rollup":"^2.23.0","rollup-plugin-multi-entry":"^2.1.0","tap":"^14.10.8"},"engines":{"node":">= 10"},"bugs":{"url":"https://github.com/dossy/simple-get-promise/issues"},"homepage":"https://github.com/dossy/simple-get-promise#readme","directories":{"test":"test"},"keywords":["get","http","https","request"],"author":{"name":"Fabio Crisci","email":"piuccio@gmail.com"},"contributors":[{"name":"Dossy Shiobara","email":"dossy@panoptic.com"}],"dependencies":{},"gitHead":"78c716847134a390bc07a4fc29a69930669ac0b0","_id":"@dossy/simple-get-promise@3.0.0","_nodeVersion":"17.2.0","_npmVersion":"8.1.4","dist":{"integrity":"sha512-dkFc+fp8p5krcXTKnNWTVW5O8nzyFdfZKKqQq9+cnM5CO3JxWIUNok4FtAb6nO1EQDsXZ5OSD4qjk4427gL/5g==","shasum":"841869fbdaa36c5fd6c2fbbe7222a7db29c1102d","tarball":"https://registry.npmjs.org/@dossy/simple-get-promise/-/simple-get-promise-3.0.0.tgz","fileCount":5,"unpackedSize":9257,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiEuQZACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqLbg//WndfkEOle34OwSfb55XWuq3wXD4BovoGLU2fmhevT27iBEs4\r\nvIiGIAD5j7xU4CFIY/0jzFr14yucRO5zlQRR6J9thNmN33p23rP+iXsRvoJV\r\nrGuMvRL9oYFQsWJ2uMihrw1HBT1Cc3veN4BUIS+MEBCID/uvz4iaw+/sQ7HV\r\n/pqA1L89SWI2vwgqKm0fdQ6wvM1eXfoY21lcbr1R+6VXNbM67Gdo4yPk4u8i\r\nFQsQr/ttOKHzQbwjtLL+Nm0UoTSzcN3CUvt1Fk1GMSfRfgOr0n7w/xmHdpu1\r\nKiBWCJks0hZd0GWSOEhFkYbLobuObJ8Dmmlp/qKnqZTXnLkcM+Im/N94IUpc\r\nYvAH0Tv8VX4sFdT05uQsBA+GEXaQHSvZEdRruw8GAYQSFt0+bjgIvmODC+Ij\r\numlM1Hgr6FjBB6517M8p5g/YbH3WUMZZGw+Tr0LTSYrNqb/h8UDjEQA1Fl8S\r\nHGT71Vf745T2cyi2c9uZ1fiTIoUAK+hjFZoh+ARabzRzpMxG8aSvr8ktNcI5\r\nPmrFaScYaNWVdQkwo9A7FtTKlwkC7IKKpq56bQd4wa/VXVhEZpDTprpBOasm\r\nS7wudTeNSZQgM4hxZMFcwf/bQHY/OooVFOtaKPSLycc/wVmywTYzMY5cwHIC\r\n/ek+yafPxWVnJevMhh62mjvOxpnWs1HoICo=\r\n=xKXZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF0LcOTQ6kYSNbdfIavk9cRS9LpTCsYS75TKON+1OBVPAiBRCvuGW7Aik472vpJ2i93OUQLHKU8L3gQNnCjjOJvFoQ=="}]},"_npmUser":{"name":"dossy","email":"dossy@panoptic.com"},"maintainers":[{"name":"dossy","email":"dossy@panoptic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-get-promise_3.0.0_1645405208968_0.9161273227430207"},"_hasShrinkwrap":false}},"time":{"created":"2022-02-21T01:00:08.832Z","3.0.0":"2022-02-21T01:00:09.137Z","modified":"2022-04-05T05:27:24.966Z"},"maintainers":[{"name":"dossy","email":"dossy@panoptic.com"}],"description":"Simple modern way to make http requests. Supports HTTPS, ES6, JSON and Promises","homepage":"https://github.com/dossy/simple-get-promise#readme","keywords":["get","http","https","request"],"repository":{"type":"git","url":"git+ssh://git@github.com/dossy/simple-get-promise.git"},"contributors":[{"name":"Dossy Shiobara","email":"dossy@panoptic.com"}],"author":{"name":"Fabio Crisci","email":"piuccio@gmail.com"},"bugs":{"url":"https://github.com/dossy/simple-get-promise/issues"},"license":"Apache-2.0","readme":"Simple modern way to make http requests. Supports HTTPS, ES6, JSON and Promises.\n\n### Simple GET\n\n```js\nimport { get } from 'simple-get-promise';\n\nget('http://example.com')\n.then(res => {\n\t// res contains\n\t// - res.statusCode\n\t// - res.responseText\n})\n.catch(error => {\n\t// Errors if connection fails or status code is not 2xx or 3xx\n\t// You can get the response in error.responseText\n});\n```\n\n### POST, PUT, HEAD ...\n\n```js\nimport { post, put, head } from 'simple-get-promise';\n\npost({\n\turl: 'http://example.com',\n\tbody: 'some body'\n})\n.then(res => {\n\t// res contains\n\t// - res.statusCode\n\t// - res.responseText\n})\n.catch(error => {\n\t// Errors if connection fails or status code is not 2xx or 3xx\n\t// You can get the response in error.responseText\n});\n```\n\nBecause `delete` is a reserved keyword, you can either use `del` or\n\n```js\nimport { get, del } from 'simple-get-promise';\n\ndel('http://example.com');\n// or\nget({\n\turl: 'http://example.com',\n\tmethod: 'delete'\n});\n```\n\n### Advanced requests\n\n```js\nimport { get } from 'simple-get-promise';\n\nget({\n\turl: 'http://example.com',\n\theaders: {\n\t\t'X-Random-Header': 'hello'\n\t}\n})\n.then(res => {\n\t// res contains\n\t// - res.statusCode\n\t// - res.responseText\n})\n.catch(error => {\n\t// Errors if connection fails or status code is not 2xx or 3xx\n\t// You can get the response in error.responseText\n});\n```\n\n#### Basic Authentication\n\n```js\nimport { get } from 'simple-get-promise';\n\nget({\n\turl: 'http://example.com',\n\tauth: 'user:password'\n})\n```\n\n#### Character encoding\n\nBy default responses are handled as UTF-8, if you're dealing with other types of encodings you can specify the value in the request object\n\n```js\nimport { get } from 'simple-get-promise';\n\nget({\n\turl: 'http://example.com',\n\tencoding: 'latin1',\n});\n```\n\nNode.js supports only a [handful of encodings](https://github.com/nodejs/node/blob/master/lib/buffer.js), if the one you needed is not available you can set `encoding: false` and handle the response directly as binary.\n\n```js\nimport { get } from 'simple-get-promise';\nimport iconv from 'iconv-lite';\n\nconst { buffer } = await get({\n\turl: 'http://example.com',\n\tencoding: false,\n});\nconsole.log(iconv.decode(buffer, 'Shift_JIS'));\n```\n\n\n### JSON\n\nExtract the message and signature from the cookie.\n\n```js\nimport { get, asJson } from 'simple-get-promise';\n\nget('http://example.com')\n.then(asJson)\n.then(json => {\n\t// json is JSON object\n})\n.catch(error => {\n\t// Errors if connection fails or status code is not 2xx or 3xx or valid JSON\n\t// You can get the response in error.responseText\n});\n```\n","readmeFilename":"README.md"}