Tiny, elegant fetch-based HTTP client with hooks, retries, timeout, and JSON/stream helpers.
// Source: https://github.com/sindresorhus/ky | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
/*! MIT License © Sindre Sorhus */
import {Ky} from './core/Ky.js';
import {requestMethods, stop, retry} from './core/constants.js';
import type {KyInstance} from './types/ky.js';
import type {Input, Options} from './types/options.js';
import {validateAndMerge} from './utils/merge.js';
import {type Mutable} from './utils/types.js';
const createInstance = (defaults?: Partial<Options>): KyInstance => {
// eslint-disable-next-line @typescript-eslint/promise-function-async
const ky: Partial<Mutable<KyInstance>> = (input: Input, options?: Options) => Ky.create(input, validateAndMerge(defaults, options));
for (const method of requestMethods) {
// eslint-disable-ne
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key