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

auto-http-agent

v1.0.0

Published

Create http agent for HTTP(S)_PROXY proxies and/or keepAlive

Downloads

20

Readme

auto-http-agent

Create an http agent for proxies and/or keepAlive. Returns a proxy if a given URL should be proxied according to the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables. Uses a global pool of agents for up to 8 combinations of options (for example, proxied https URLs will share an agent).

npm status node Test JavaScript Style Guide

Usage

const autoAgent = require('auto-http-agent')

const url = 'http://example.com'
const agent = autoAgent(url)

// Pass to your module of choice
request(url, { agent })

API

autoAgent(url[, options])

The url argument is required and must either be a string or a WHATWG URL instance, with an HTTP or HTTPS protocol.

Options:

  • keepAlive (boolean): reuse connections between requests, default false.

Returns an agent or null if the default agent can be used (i.e. http.globalAgent or https.globalAgent). Has a fast path for the common case of not having any configured proxy. The autoAgent module should behave the same as good old request and other software. It respects the following environment variables.

HTTP_PROXY

A proxy URL to use for HTTP requests, e.g. http://localhost:3000. The proxy itself can be either HTTP or HTTPS.

HTTPS_PROXY

A proxy URL to use for HTTPS requests. The proxy itself can be either HTTP or HTTPS.

NO_PROXY

A comma-separated list of hosts (including subdomains) that should not be proxied. Supported forms:

  • hostname:port
  • hostname or .hostname or *.hostname
  • * to disable proxying for all URLs

Install

With npm do:

npm install auto-http-agent

License

MIT © Vincent Weevers