@zgcos/fetch
v1.0.1
Published
ZGCOS fetch utility library
Downloads
203
Readme
@zgcos/fetch
ZGCOS fetch utility library
Installation
npm install @zgcos/fetch
# or
pnpm add @zgcos/fetch
# or
yarn add @zgcos/fetchUsage
import { fetchWithTimeout, fetchJSON } from '@zgcos/fetch';
// Fetch with timeout
const response = await fetchWithTimeout('https://api.example.com/data', {
timeout: 5000,
});
// Fetch JSON
const data = await fetchJSON<{ name: string }>('https://api.example.com/user');API
fetchWithTimeout(url, options?)
Enhanced fetch with timeout support.
fetchJSON<T>(url, options?)
Fetch and parse JSON response.
FetchError
Custom error class for fetch operations.
