npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@4i4/multi-request

v1.0.2

Published

Multi-request for AXIOS

Readme

MultiRequest

Build multiple requests based on Axios with option for subrequests and execute them as concurrent requests.

How this package can help you?

This module is using Axios as HTTP client and can be considered as helper If you need to execute concurrent requests or/and have dependencies between the requests.

Installing:

Using npm:

$ npm install @4i4/multi-request

Using yarn:

$ yarn add @4i4/multi-request

Using pnpm:

$ pnpm add @4i4/multi-request

Example

import MultiRequest from "@4i4/multi-request";

const baseUrl = "https://swapi.dev"
const client = new MultiRequest(baseUrl);

client.addRequest({
  id: "film",
  url: "/api/films/1",
  subrequest: response => {
    const { characters } = response.data;
    return characters.map((url, index) => ({
      id: `character-${index}`,
      url: url
    }));
  }
});
client.addRequest({
  id: "people",
  url: "/api/people/",
  onSuccess: response => {
    console.log("People:");
    console.table(response.data.results);
  }
});
client.addRequest({
  id: "planets",
  url: "/api/planets/",
  onSuccess: response => {
    console.log("Planets:");
    console.table(response.data.results);
  }
});
client.addRequest({
  id: "species",
  url: "/api/species/",
  onSuccess: response => {
    console.log("Species:");
    console.table(response.data.results);
  }
});

await client.execute();

Creating an instance

new MultiRequest()

const client = new MultiRequest();

new MultiRequest([baseUrl])

const client = new MultiRequest("https://swapi.dev"); // common baseUrl

new MultiRequest([options])

const client = new MultiRequest({
  baseUrl: "https://swapi.dev", // common baseUrl
  headers: {} // common headers
});

Instance methods

.addRequest(config)

Request Config

The multi-request configuration is extended version of Axios Request configuration.
The list bellow is what MultiRequest introduce. For all other properties and methods please check here.

| Property | Type | Optional | Description | |--------------|------------|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | id | string | Yes | id is the request ID that can be used to identify the response for this request. If one is not provided it will be automatically created. | | weight | number | Yes | It will be used to sort the responses. The default value is 0 | | subrequest | function | Yes | The subrequest method receives two parameters - response and requestId. It should return new request configuration or array of request configurations. | | onSuccess | function | Yes | The onSuccess method receives two parameters - response and requestId. | | onError | function | Yes | It's receiving an error object. |

.execute()

Execute all requests and returns the responses sorted by the weight property.

.getResponseHeaders([requestId])

| Request ID | Description | |----------------|--------------------------------------------------| | null | Returns the response headers from all requests. | | string | Returns the response headers for single request. | | RegExp | Returns the response headers for each match. |

.getResponseData([requestId])

| Request ID | Description | |----------------|-----------------------------------------------| | null | Returns the response data from all requests. | | string | Returns the response data for single request. | | RegExp | Returns the response data for each match. |