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 🙏

© 2024 – Pkg Stats / Ryan Hefner

axios-extra

v0.0.8

Published

Extend "Axios"; add concurrency limits, retry, etc.

Downloads

251

Readme

axios-extra

Coverage Status github test

通过 ES6 的Proxy对像, 让 axios 集成 promise-queue-plus, 使 axios 支持 最大并发出错重试 的功能.

未添加任何 API, 你完全可以像使用 axios 那样使用 axios-extra; 由于使用了Proxy,请注意兼性.

API

axios.create(config)

现在可以通过设置 maxConcurrentqueueOptions 属性, 设置最大并发及重试次数.

// axios 并发为10, 自动重试为0
const axios = require('axios-extra'); //默认最大并发 10, 重试 0;

// 创建一个 并发为1, 自动重试为3的 axios;
let axios1 = axios.create({
	maxConcurrent:1, //并发为1
	queueOptions: {
		retry:3, //请求失败时,最多会重试3次
		retryIsJump: true //是否立即重试, 否则将在请求队列尾部插入重试请求
	}
});

let {stop, start, clear} = axios1.requestQueue; // 暴露内部的队列对像,可以使用 stop start clear 等 API;

更多 queueOptions 配制可参看这里

axios(config) 及 get|post|request|delete|head|options|put|patch

config参数可以为某一次的请求设置 queueOptions;

axios.get('https://www.google.com',{
	queueOptions : {
		retry: 5
	}
});

create(axios,maxConcurrent,queueOptions) 扩展现有 axios

扩展项目中现有 axios,保证 axios 版本.

const aec = require('axios-extra/create');
const axios = aec(requeir('axios'), 5, { retry: 5 });