1.0.1 • Published 5 years ago

elex v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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