{"id":22886524,"url":"https://github.com/tomphttp/bare-client","last_synced_at":"2025-05-07T10:27:42.538Z","repository":{"id":37387068,"uuid":"478270408","full_name":"tomphttp/bare-client","owner":"tomphttp","description":"Tomp Bare Client.","archived":false,"fork":false,"pushed_at":"2024-03-04T22:43:56.000Z","size":275,"stargazers_count":15,"open_issues_count":1,"forks_count":21,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-07T00:19:54.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomphttp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-05T19:23:35.000Z","updated_at":"2024-07-18T15:18:52.000Z","dependencies_parsed_at":"2024-06-18T17:11:37.638Z","dependency_job_id":null,"html_url":"https://github.com/tomphttp/bare-client","commit_stats":{"total_commits":171,"total_committers":4,"mean_commits":42.75,"dds":"0.39766081871345027","last_synced_commit":"5f41f20b493b351de81a7e937a44caae34559937"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomphttp%2Fbare-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomphttp%2Fbare-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomphttp%2Fbare-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomphttp%2Fbare-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomphttp","download_url":"https://codeload.github.com/tomphttp/bare-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229609141,"owners_count":18098133,"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-12-13T20:19:07.446Z","updated_at":"2024-12-13T20:19:08.401Z","avatar_url":"https://github.com/tomphttp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bare Client\n\nThis package implements the [TompHTTP Bare Server](https://github.com/tomphttp/specifications/blob/master/BareServer.md) as a client.\n\nSee the [V2 API documentation](./docs/V2.md).\n\nSee the [changelog](./CHANGELOG.md).\n\n## Upgrading\n\nA guide for updating from v1 to v2 can be found [here](./docs/V2-UPGRADE-GUIDE.md).\n\n## Older Bare servers\n\nStarting from v2, @tomphttp/bare-client only supports Bare servers v3+.\n\nIf you operate an outdated Bare server, we encourage you to update. If you're using an outdated Bare server, we encourage you to find an updated Bare server or host your own.\n\nIf you're too lazy to do either of the above, you can install an outdated and unsupported version of the Bare client.\n\n```sh\nnpm install @tomphttp/bare-client@1\n```\n\n## Quickstart\n\nScript tag:\n\n```html\n\u003cscript src=\"https://unpkg.com/@tomphttp/bare-client@placeholder/dist/bare.cjs\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n\tconsole.log(bare); // { createBareClient: ..., BareClient: ... }\n\n\tbare.createBareClient('http://localhost:8080/bare/').then(async (client) =\u003e {\n\t\tconst res = await client.fetch('https://api.github.com/orgs/tomphttp', {\n\t\t\theaders: {\n\t\t\t\t'user-agent': navigator.userAgent, // user-agent must be passed otherwise the API gives a 403\n\t\t\t},\n\t\t});\n\n\t\tconsole.log(await res.json()); // {login: 'tomphttp', id: 98234273, ... }\n\t});\n\u003c/script\u003e\n```\n\nESM/bundler:\n\n```sh\nnpm i @tomphttp/bare-client\n```\n\n```js\nimport { createBareClient } from '@tomphttp/bare-client';\n\ncreateBareClient('http://localhost:8080/bare/'); // ...\n```\n\nSee [examples/](examples/).\n\n## Notice\n\n`client.fetch` isn't 1:1 to JavaScript's `fetch`. It doesn't accept a `Request` as an argument due to the headers on the `Request` being \"managed\":\n\n```js\nconst a = new Headers(); // unmanaged `Headers`\na.set('user-agent', 'test');\na.get('user-agent'); // \"test\"\n\nconst b = new Request(location.toString()).headers; // managed `Headers`\nb.set('user-agent', 'test');\nb.get('user-agent'); // null\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomphttp%2Fbare-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomphttp%2Fbare-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomphttp%2Fbare-client/lists"}