⚡Z‑Fetch

⚡Z‑Fetch

The 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

Automatic caching with auto revalidation and configurable options.

Auto JSON Parsing

Automatic JSON parsing of responses and request payload.

Streaming Support

Built-in streaming utilities for stream responses handling.

Progress Tracking

Real-time progress tracking for file uploads and downloads.

Powerful Hooks System

Hooks are interceptors for the request lifecycle.

Error Mapping

Catch common errors nicely with customizable error message mapping.

More than just fetching

You can cancel requests, set timeout, custom HTTP methods and more.