# sync-fetch

> Synchronous version of the Fetch API

Latest version **0.6.0** (published 2026-01-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install sync-fetch
pnpm add sync-fetch
yarn add sync-fetch
bun add sync-fetch
```

## Health

**Score 58/100 (C)** — status: stable.

Positive: has types package; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.0 |
| Published | 2026-01-01 |
| First published | 2019-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/sync-fetch) |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 42.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 43 |
| Author | Lars Willighagen |
| Maintainers | larsgw |
| Keywords | fetch, sync |

## Links

- npm: https://www.npmjs.com/package/sync-fetch
- Repository: https://github.com/larsgw/sync-fetch
- Homepage: https://github.com/larsgw/sync-fetch#readme
- Issues: https://github.com/larsgw/sync-fetch/issues
- npm.io page: https://npm.io/package/sync-fetch

## Dependencies (3)

- [node-fetch](https://npm.io/package/node-fetch.md) ^3.3.2
- [timeout-signal](https://npm.io/package/timeout-signal.md) ^2.0.0
- [whatwg-mimetype](https://npm.io/package/whatwg-mimetype.md) ^4.0.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.6.0 (latest) — 2026-01-01
- 0.6.0-2 — 2024-11-20
- 0.6.0-1 — 2024-11-20
- 0.6.0-0 — 2024-11-19
- 0.5.2 — 2023-06-11
- 0.5.1 — 2023-06-11
- 0.5.0 — 2023-06-11
- 0.4.5 — 2023-06-11
- 0.4.4 — 2023-06-11
- 0.4.3 — 2023-06-11
- 0.4.2 — 2022-09-24
- 0.4.1 — 2022-05-26
- 0.4.0 — 2022-05-26
- 0.3.1 — 2021-10-09
- 0.3.0 — 2020-11-02
- … 4 more at https://npm.io/package/sync-fetch/versions

## README

# sync-fetch
Synchronous wrapper around the Fetch API. Uses [`node-fetch`](https://github.com/bitinn/node-fetch) under the hood, and for some input-parsing code and test cases too.

[![npm](https://img.shields.io/npm/v/sync-fetch?style=flat-square)](https://npmjs.com/package/sync-fetch)
[![npm monthly downloads](https://img.shields.io/npm/dm/sync-fetch?style=flat-square)](https://npm-stat.com/charts.html?package=sync-fetch)

## Install

    npm install sync-fetch

In the browser, a browserify bundle can be loaded from CDNs like unpkg.com.

```html
<script src="https://unpkg.com/sync-fetch"></script>
<script src="https://unpkg.com/sync-fetch@VERSION"></script>
```

## Use

```js
const fetch = require('sync-fetch')

const metadata = fetch('https://doi.org/10.7717/peerj-cs.214', {
  headers: {
    Accept: 'application/vnd.citationstyles.csl+json'
  }
}).json()
// arrayBuffer(), blob(), buffer(), json(), and text() supported
```

## Limitations

### Node.js

  - Does not support `Stream` or `Blob` as input body since they cannot be read or serialized synchronously
  - Does not support `FormData` as input body yet as it has no built-in method to be serialized
  - Does not support the non-spec `agent` option as its value cannot be serialized
  - Does not support non-standard `textConverted()` method on `SyncResponse` and `SyncRequest`

### Browser

  - Does not support most options, since `XMLHttpRequest` is pretty limited. Supported are:
    - `method`
    - `body`
    - `headers`
    - `credentials` (but not `omit`)
    - (Non-spec) `timeout`
  - The non-standard `buffer()` and `textConverted()` methods are not supported
  - CORS limitations apply, of course (note they may be stricter for synchronous requests)

---
_Source: https://npm.io/package/sync-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
