elex

Perform check on list of gateway to find the best reliable http gateway

Usage no npm install needed!

<script type="module">
  import elex from 'https://cdn.skypack.dev/elex';
</script>

README

elex

Perform check on list of gateway to find the best reliable http gateway

npm version Build Status FOSSA Status

Installation

yarn add elex

Usage

Elect some (some most fastest):

import {electSome} from 'elex'

(async () => {
  const urlsToCheck = ['https://google.com', 'https://bing.com', 'https://vgm.tv', 'https://not-found-404.com']
  const someFastUrls = await electSome(urlsToCheck, {count: 2, retries: 1}); // ['http://google.com', 'https://vgm.tv']
})()

Elect any (the fastest one):

import {electAny} from 'elex'

(async () => {
  const urlsToCheck = ['https://google.com', 'https://bing.com', 'https://vgm.tv', 'https://not-found-404.com']
  const mostFastUrls = await electAny(urlsToCheck, {prefer: 'https://vgm.tv', retries: 1}); // 'https://vgm.tv'
})()

License

FOSSA Status