1.0.11 • Published 1 year ago

qlu-fetch v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

fetch

Getting started

  import fetch from 'qlu-fetch'

Call with constant pause time

  let res = await fetch('https://randomuser.me/api', {
     method: 'GET',
     retry: 3,
     pause: 1000 
  })

Call with different pause time for every request

  let res = await fetch('https://randomuser.me/api', { 
     method: 'GET',
     retry: 3,
     pause: [ 1000, 2000, 3000 ] 
  })

Options allowed in addition to node-fetch options

  • retry: Number \ count of retires you want
  • pause : Number | Array \ Time to dealy between two consecutive retries in case of Array retry must be equal to array.length
  • timeout: Number \ Abort all requests after timeout
  • simultaneous: Boolean \ If true retires run simultaneously and return first response

    Functions Signature

     import { RequestInfo, RequestInit } from "node-fetch"
    
     type RequestOptions = RequestInit & {
        retry?: number,
        pause?: number | Array<number>,
        timeout?: number,
        simultaneous?: boolean
     }
    
     function fetch(url: RequestInfo, options?: RequestOptions): Promise<Response> 
1.0.9

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago