# sync-fetch-undici

> Synchronous version of the Fetch API

Latest version **0.7.1** (published 2026-09-15) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

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

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2026-09-15 |
| First published | 2026-09-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=22.12.0 |
| Dependencies | 1 |
| Unpacked size | 42.4 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-undici
- 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-undici

## Dependencies (1)

- [whatwg-mimetype](https://npm.io/package/whatwg-mimetype.md) ^5.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.7.1 (latest) — 2026-09-15
- 0.7.0 — 2026-09-15

## README

# sync-fetch-undici
Synchronous wrapper around the Fetch API. Uses the builtin version of `fetch`, based on [`undici`](https://github.com/nodejs/undici).
See [sync-fetch](https://npmjs.com/package/sync-fetch) for a similar package based on [`node-fetch`](https://github.com/node-fetch/node-fetch).

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

## Install

    npm install sync-fetch-undici

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

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

## Use

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

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 can contain a `Blob`
  - Does not support `signal` as it cannot be implemented synchronously; instead does support the non-standard
    option `timeout` (a `number` of seconds)
  - `undici` applies some parts of the specification more suited to browser usage; for example setting
    the `Host` header or other ["forbidden request headers"](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_request_header)
    is not possible.
  - `undici` versions below `7.20.0` contain [a bug](https://github.com/nodejs/undici/issues/4789) breaking
    redirects of `POST` and `PATCH` requests with request bodies. The patched version of `undici` is shipped
    starting with Node.js v24.14.0; no backport for v22 has been made.

### 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; note they may be stricter for synchronous requests

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