fetchify

deno.land/x/luminous popularity
npm version npm downloads
npm license

import fetchify from "https://deno.land/x/fetchify/mod.ts";

const jph = fetchify.create({
  limiter: {
    rps: 10,
    interval: 10,
  },
  baseURL: "https://jsonplaceholder.typicode.com",
  headers: {
    "hello": "world",
  },
});

for (let i = 30; i--;) {
  console.log(`send ${i}`);
  jph.get(`/posts/${i}`).then((data) => console.log(`${i} ${data.status}`))
    .catch((err) => console.log(`${i} ${err}`))
    .finally(() => {
    });
}