⚡Z‑Fetch

⚡Z‑Fetch

A pragmatic native fetch API wrapper for JavaScript.

npm install @z-fetch/fetch
import { GET } from '@z-fetch/fetch';

async function getPosts() {
  const { data, error } = await GET('https://jsonplaceholder.typicode.com/posts');
  if (data) {
    console.log('Posts:', data);
  } else {
    console.error('Error fetching posts:', error);
  }
}

getPosts();

Zero Dependencies

Built on the native fetch API with no extra libraries needed.

Framework Agnostic

Works with any JavaScript project, no matter the framework.

Built-in Caching

Automatically caches responses with auto revalidation for optimized performance.

Auto JSON Parsing

Automatically parses JSON responses with minimal boilerplate.

Retries & Polling

Supports configurable request retries and polling mechanisms.

Builtin Helpers

Has builtin helpers for most common use cases.

Request Cancellation

Cancel requests on demand with built‑in cancellation support.

Extended HTTP Methods

Supports OPTIONS, TRACE, HEAD, and custom HTTP verbs without extra setup.

Hooks - Interceptors

You can use hooks to intercept and transform requests and responses.