global-agent-ng

Opinionated wrapper around `global-agent`

Usage no npm install needed!

<script type="module">
  import globalAgentNg from 'https://cdn.skypack.dev/global-agent-ng';
</script>

README

global-agent-ng

build status install size npm package version github license js semistandard style

Opinionated wrapper around global-agent

Installation

npm install global-agent-ng

Usage

As early as possible in your application, require and configure global-agent-ng.

require('global-agent-ng').config();

Preload

You can use the -r, --require command line option to preload global-agent-ng. By doing this, you do not need to require and load global-agent-ng in your application code.

node -r global-agent-ng/config script.js

Configure global-agent-ng using environment variables

The following environment variables are respected by global-agent-ng:

  • HTTP_PROXY / http_proxy
  • HTTPS_PROXY / https_proxy
  • NO_PROXY / no_proxy

API

Table of Contents

exports.agent

global proxy agent instance

Type: ProxyAgent

exports.isProxying

proxying status

Type: Boolean

config

Bootstrap global proxy agent

Parameters

Examples

// Bootstrap global proxy agent
require('global-agent-ng').config();
//=> true

// Global proxy agent is already bootstrapped
require('global-agent-ng').config();
//=> false

Returns Boolean bootstraping result

ProxyAgentConfig

ProxyAgent