elex
v1.0.1
Published
Perform check on list of gateway to find the best reliable http gateway
Readme
elex
Perform check on list of gateway to find the best reliable http gateway
Installation
yarn add elexUsage
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'
})()