@kirishima/fetch
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Kirishima Banner

@kirishima/fetch

Description

This code is forked from @sapphire/fetch code, i forked because of they still uses node-fetch instead undici. usage may same with @sapphire/fetch

Features

  • Written in TypeScript
  • Exported const enum for the common return data types.
  • Support ESM & CommonJS

Installation

npm install @kirishima/fetch undici

Example

// Import the fetch function
import { fetch, FetchResultTypes } from '@kirishima/fetch';

interface JsonPlaceholderResponse {
	userId: number;
	id: number;
	title: string;
	completed: boolean;
}

// Fetch the data. No need to call `.json()` after making the request!
const data = await fetch<JsonPlaceholderResponse>('https://jsonplaceholder.typicode.com/todos/1', undefined, FetchResultTypes.JSON);

// Do something with the data
console.log(data.userId);

Readme

Keywords

none

Package Sidebar

Install

npm i @kirishima/fetch

Weekly Downloads

116

Version

0.3.3

License

GPL-3.0

Unpacked Size

47.5 kB

Total Files

21

Last publish

Collaborators

  • kagchi