Socket
Book a DemoInstallSign in
Socket

fetch-extras

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-extras

Useful utilities for working with Fetch

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
3.6K
36.12%
Maintainers
0
Weekly downloads
 
Created
Source

fetch-extras logo

Useful utilities for working with Fetch

For more features and conveniences on top of Fetch, check out my ky package.

Install

npm install fetch-extras

Usage

import {withHttpError, withTimeout} from 'fetch-extras';

// Create an enhanced reusable fetch function that:
// - Throws errors for non-200 responses
// - Times out after 5 seconds
const enhancedFetch = withHttpError(withTimeout(fetch, 5000));

const response = await enhancedFetch('/api');
const data = await response.json();

API

See the types for now.

  • is-network-error - Check if a value is a Fetch network error
  • ky - HTTP client based on Fetch

Keywords

fetch

FAQs

Package last updated on 06 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts