@balena/fetch

0.0.11 • Public • Published

@balena/fetch

This is Balena's implementation of fetch, but others could find it useful too.

Features:

  • happy eyeballs
    • Attempt connections to all addresses provided getaddrinfo, not just the first one
    • Attempt connection to both IPv6 and IPv4 concurrently for dual-stack hosts
    • Remember last successful connection type and try that first for next request
  • browser/node safe
  • ...more to come

This is meant to replace all naked calls to http.request, fetch, node-fetch, @balena/request, etc.

Installation

npm i --save @balena/fetch

Usage

import fetch from '@balena/fetch';

const resp = await fetch('https://api.balena-cloud.com/ping');
console.log(await resp.text()) // <= OK

Readme

Keywords

none

Package Sidebar

Install

npm i @balena/fetch

Weekly Downloads

0

Version

0.0.11

License

ISC

Unpacked Size

23.5 kB

Total Files

17

Last publish

Collaborators

  • dfunckt
  • page
  • balena.io