{"id":17034546,"url":"https://github.com/caub/fetchu","last_synced_at":"2025-04-12T13:13:13.562Z","repository":{"id":57234782,"uuid":"112684960","full_name":"caub/fetchu","owner":"caub","description":"🔧 Universal http-client, gotta fetch'em all","archived":false,"fork":false,"pushed_at":"2021-03-01T12:47:20.000Z","size":30,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T13:13:09.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-01T02:24:37.000Z","updated_at":"2022-10-07T15:29:39.000Z","dependencies_parsed_at":"2022-09-15T06:40:48.388Z","dependency_job_id":null,"html_url":"https://github.com/caub/fetchu","commit_stats":null,"previous_names":["caub/fetcho"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Ffetchu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Ffetchu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Ffetchu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caub%2Ffetchu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caub","download_url":"https://codeload.github.com/caub/fetchu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571863,"owners_count":21126522,"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":[],"created_at":"2024-10-14T08:43:55.889Z","updated_at":"2025-04-12T13:13:13.537Z","avatar_url":"https://github.com/caub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fetchu: universal http-client\n\n[![npm version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n\n### Differences with fetch:\n- automatically handle json body (`JSON.stringify` a body that is an objet literal, and add the right header)\n- throws on http error status\n\n### Files:\n- fetchu-node.js: using `http`/`https` modules for NodeJS, light drop-in replacement for `node-fetch`\n- fetchu-browser.js: it wraps `window.fetch`\n\n```js\nimport fetchu from 'https://unpkg.com/fetchu';\n\nawait fetchu('https://cors-anywhere.herokuapp.com/http://example.com').then(r =\u003e r.text()) // \u003c!doctype html\u003e\u003chtml ...\nawait fetchu('https://httpbin.org/get?test=foo').then(r =\u003e r.json()) // { args: { test: 'foo' }, ...\nawait fetchu('https://httpbin.org/post', {method: 'POST', body: {test: 'foo'}}).then(r =\u003e r.json()) // { args: {},..\n\n// abort:\nconst ac = new AbortController()\nfetchu('https://httpbin.org/get?test=foo', { signal: ac.signal }).then(console.log, console.error)\ndelay(10).then(() =\u003e ac.abort())\n```\n\nNodeJS specificities (coming from http/https builtins):\n```js\nconst fetchu = require('fetchu');\nawait fetchu({ path: '/v1.37/containers/json', socketPath: '/var/run/docker.sock' }).then(r =\u003e r.json()) // [ { Id: 'aa6...\n\n// abort:\nrequire('abortcontroller-polyfill/dist/abortcontroller-polyfill-only');\nconst ac = new AbortController()\nfetchu('https://httpbin.org/get?test=foo', { signal: ac.signal }).then(console.log, console.error)\ndelay(10).then(() =\u003e ac.abort());\n// or \nconst signal = new EventEmitter(); // node.js native events.EventEmitter\nfetchu('https://httpbin.org/get?test=foo', { signal }).then(console.log, console.error)\ndelay(10).then(() =\u003e signal.emit('abort'))\n```\n\n[npm-image]: https://img.shields.io/npm/v/fetchu.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/fetchu\n[travis-image]: https://img.shields.io/travis/caub/fetchu.svg?style=flat-square\n[travis-url]: https://travis-ci.org/caub/fetchu\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaub%2Ffetchu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaub%2Ffetchu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaub%2Ffetchu/lists"}