turist-cloud / fetch

Opinionated `fetch` (with retrying and DNS caching) optimized for use inside microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@turist/fetch

Opinionated fetch optimized for use inside microservices.

It automatically configures an agent via agentkeepalive, if not provided, with the following settings:

Name Value
maxSockets 50
maxFreeSockets 20
timeout 60000
freeSocketKeepAliveTimeout 30000

How to use

const fetch = require('@turist/fetch').default(require('some-fetch-implementation'))
import createFetch from '@turist/fetch';

const fetch = createFetch();

If no fetch implementation is supplied, it will attempt to use peerDep node-fetch.

About

Opinionated `fetch` (with retrying and DNS caching) optimized for use inside microservices

License:MIT License


Languages

Language:TypeScript 100.0%