{"id":22005500,"url":"https://github.com/systemsoftware/fetch","last_synced_at":"2026-05-21T05:02:39.003Z","repository":{"id":252149042,"uuid":"839574220","full_name":"systemsoftware/fetch","owner":"systemsoftware","description":"Simple Promise-based HTTP client","archived":false,"fork":false,"pushed_at":"2024-08-15T16:24:24.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T06:29:12.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@systemsoftware/fetch","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/systemsoftware.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":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T22:33:01.000Z","updated_at":"2024-08-15T16:24:28.000Z","dependencies_parsed_at":"2025-03-23T06:37:22.045Z","dependency_job_id":null,"html_url":"https://github.com/systemsoftware/fetch","commit_stats":null,"previous_names":["systemsoftware/fetch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/systemsoftware/fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemsoftware%2Ffetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemsoftware%2Ffetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemsoftware%2Ffetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemsoftware%2Ffetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/systemsoftware","download_url":"https://codeload.github.com/systemsoftware/fetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/systemsoftware%2Ffetch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262382260,"owners_count":23302258,"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-11-30T00:20:01.725Z","updated_at":"2026-05-21T05:02:38.944Z","avatar_url":"https://github.com/systemsoftware.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @systemsoftware/fetch\nSimple Promise-based HTTP client for Node.js\n\n## Features\n- Promise-based\n- Simple API that's similar to the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)\n- Supports the full [Request API](https://developer.mozilla.org/en-US/docs/Web/API/Request)\n- Supports the full [Headers API](https://developer.mozilla.org/en-US/docs/Web/API/Headers)\n- Powered by the built-in [http](https://nodejs.org/api/http.html) and [https](https://nodejs.org/api/https.html) modules\n- Supports chunked responses\n- Supports JSON, ArrayBuffer, Blob, FormData, and text responses\n- Supports AbortController, AbortSignal, and timeout\n- ESM and CommonJS support\n- Lightweight and zero dependencies\n\n## Table of Contents\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Basic](#basic)\n    - [fetch](#fetch)\n    - [Request Support](#request-support)\n    - [Silence Errors](#silence-errors)\n    - [AbortController](#abortcontroller)\n    - [onData](#ondata)\n- [Response](#response)\n\n\n## Installation\n```bash\nnpm install @systemsoftware/fetch\n```\n## Usage\n### Basic\nWhere `METHOD` is one of the following: `get`, `post`, `put`, `delete`, `head`, `patch`.\n```js\nconst fetch = require('@systemsoftware/fetch');\nfetch.METHOD('https://example.com')\n    .then(response =\u003e response.json())\n    .then(data =\u003e console.log(data))\n    .catch(error =\u003e console.error(error));\n```\n### fetch\n```js\nconst { fetch } = require('@systemsoftware/fetch');\nfetch('https://example.com', { method: 'GET' })\n    .then(response =\u003e response.json())\n    .then(data =\u003e console.log(data))\n    .catch(error =\u003e console.error(error));\n```\n### Request Support\n```js\nconst req = new Request('https://example.com', { method: 'GET', headers:new Headers({ 'Content-Type': 'application/json' }) });\nfetch(req)\n    .then(response =\u003e response.json())\n    .then(data =\u003e console.log(data))\n    .catch(error =\u003e console.error(error));\n```\n### Silence Errors\nBy default, @systemsoftware/fetch will throw an error if the response status code is not in the range 200-299. To silence these errors, you can use the `silent` option and the response will be returned regardless of the status code.\n```js\nconst { fetch } = require('@systemsoftware/fetch');\nfetch('https://example.com', { method: 'GET', silent: true })\n    .then(response =\u003e response.json())\n    .then(data =\u003e console.log(data))\n```\n\n### AbortController\nTo abort a request, you can use the `AbortController` class.\n```js\nconst { fetch } = require('@systemsoftware/fetch');\nconst controller = new AbortController();\n\nfetch('https://example.com', { method: 'GET', signal: controller.signal })\n\ncontroller.abort();\n```\n\n### onData\nTo handle the response data in chunks, you can use the `onData` option.\n```js\nconst { fetch } = require('@systemsoftware/fetch');\nfetch('https://example.com', { method: 'GET', onData: chunk =\u003e console.log(chunk) })\n    .then(response =\u003e console.log('Response finished'))\n    .catch(error =\u003e console.error(error));\n```\n\n## Response\nThe response object is what is returned by the http request, with these additional methods:\n- `json` - A promise that returns the response body as JSON\n- `text` - A promise that returns the response body as text\n- `arrayBuffer` - A promise that returns the response body as an ArrayBuffer\n- `blob` - A promise that returns the response body as a Blob","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemsoftware%2Ffetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsystemsoftware%2Ffetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsystemsoftware%2Ffetch/lists"}