{"id":22802455,"url":"https://github.com/ethan7g/phin","last_synced_at":"2025-04-04T13:13:45.944Z","repository":{"id":48637013,"uuid":"82648431","full_name":"ethan7g/phin","owner":"ethan7g","description":"Node HTTP client","archived":false,"fork":false,"pushed_at":"2024-04-11T00:46:08.000Z","size":3675,"stargazers_count":576,"open_issues_count":24,"forks_count":33,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T19:04:21.737Z","etag":null,"topics":["http","http-client","https","javascript","node","nodejs","npm","phin","request"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethan7g.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-21T07:12:21.000Z","updated_at":"2025-01-03T00:57:10.000Z","dependencies_parsed_at":"2024-06-18T12:19:13.235Z","dependency_job_id":"8da94b31-0fcd-4833-84ef-481eb50321fd","html_url":"https://github.com/ethan7g/phin","commit_stats":{"total_commits":133,"total_committers":8,"mean_commits":16.625,"dds":0.09022556390977443,"last_synced_commit":"5deab76adc41c660d3470596395429758f97bea5"},"previous_names":["ethan7g/phin","ethanent/phin"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethan7g%2Fphin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethan7g%2Fphin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethan7g%2Fphin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethan7g%2Fphin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethan7g","download_url":"https://codeload.github.com/ethan7g/phin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247148091,"owners_count":20891843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","http-client","https","javascript","node","nodejs","npm","phin","request"],"created_at":"2024-12-12T09:03:59.139Z","updated_at":"2025-04-04T13:13:45.921Z","avatar_url":"https://github.com/ethan7g.png","language":"JavaScript","readme":"\u003cp align=\"center\" style=\"text-align: center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/ethanent/phin/master/media/phin-textIncluded.png\" width=\"250\" alt=\"phin logo\"/\u003e\u003c/p\u003e\n\n---\n\n\u003e The lightweight Node.js HTTP client\n\n[Full documentation](https://ethanent.github.io/phin/global.html) | [GitHub](https://github.com/ethanent/phin) | [NPM](https://www.npmjs.com/package/phin)\n\n## Deprecation warning\n\nSome versions of this package are deprecated and shouldn't be used. Be sure you are using a non-deprecated, supported version of the package.\n\n## Simple Usage\n\n```javascript\nconst p = require('phin')\n\nconst res = await p('https://ethanent.me')\n\nconsole.log(res.body)\n```\n\nNote that the above should be in an async context! Phin also provides an unpromisified version of the library.\n\n\n## Install\n\n```\nnpm install phin\n```\n\n\n## Why Phin?\n\nPhin is relied upon by important projects and large companies. The hundreds of contributors at [Less](https://github.com/less/less.js), for example, depend on Phin as part of their development process.\n\nAlso, Phin is very lightweight. To compare to other libraries, see [Phin vs. the Competition](https://github.com/ethanent/phin/blob/master/README.md#phin-vs-the-competition).\n\n## Quick Demos\n\nSimple POST:\n\n```js\nawait p({\n\turl: 'https://ethanent.me',\n\tmethod: 'POST',\n\tdata: {\n\t\they: 'hi'\n\t}\n})\n```\n\n### Unpromisified Usage\n\n```js\nconst p = require('phin').unpromisified\n\np('https://ethanent.me', (err, res) =\u003e {\n\tif (!err) console.log(res.body)\n})\n```\n\nSimple parsing of JSON:\n\n```js\n// (In async function in this case.)\n\nconst res = await p({\n\t'url': 'https://ethanent.me/name',\n\t'parse': 'json'\n})\n\nconsole.log(res.body.first)\n```\n\n### Default Options\n\n```js\nconst ppostjson = p.defaults({\n\t'method': 'POST',\n\t'parse': 'json',\n\t'timeout': 2000\n})\n\n// In async function...\n\nconst res = await ppostjson('https://ethanent.me/somejson')\n// ^ An options object could also be used here to set other options.\n\n// Do things with res.body?\n```\n\n### Custom Core HTTP Options\n\nPhin allows you to set [core HTTP options](https://nodejs.org/api/http.html#http_http_request_url_options_callback).\n\n```js\nawait p({\n\t'url': 'https://ethanent.me/name',\n\t'core': {\n\t\t'agent': myAgent // Assuming you'd already created myAgent earlier.\n\t}\n})\n```\n\n\n## Full Documentation\n\nThere's a lot more which can be done with the Phin library.\n\nSee [the Phin documentation](https://ethanent.github.io/phin/global.html).\n\n\n## Phin vs. the Competition\n\nPhin is a very lightweight library, yet it contains all of the common HTTP client features included in competing libraries!\n\nHere's a size comparison table:\n\nPackage | Size\n--- | ---\nrequest | [![request package size](https://packagephobia.now.sh/badge?p=request)](https://packagephobia.now.sh/result?p=request)\nsuperagent | [![superagent package size](https://packagephobia.now.sh/badge?p=superagent)](https://packagephobia.now.sh/result?p=superagent)\ngot | [![got package size](https://packagephobia.now.sh/badge?p=got)](https://packagephobia.now.sh/result?p=got)\naxios | [![axios package size](https://packagephobia.now.sh/badge?p=axios)](https://packagephobia.now.sh/result?p=axios)\nisomorphic-fetch | [![isomorphic-fetch package size](https://packagephobia.now.sh/badge?p=isomorphic-fetch)](https://packagephobia.now.sh/result?p=isomorphic-fetch)\nr2 | [![r2 package size](https://packagephobia.now.sh/badge?p=r2)](https://packagephobia.now.sh/result?p=r2)\nnode-fetch | [![node-fetch package size](https://packagephobia.now.sh/badge?p=node-fetch)](https://packagephobia.now.sh/result?p=node-fetch)\nphin | [![phin package size](https://packagephobia.now.sh/badge?p=phin)](https://packagephobia.now.sh/result?p=phin)\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethan7g%2Fphin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethan7g%2Fphin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethan7g%2Fphin/lists"}