/ c4f / front / node_modules / @npmcli / agent /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]lib/9 months ago -  
[DIR]node_modules/9 months ago -  
[TXT]README.md9 months ago1.9K 
[   ]package.json9 months ago1.5K 
README.md

@npmcli/agent

A pair of Agent implementations for nodejs that provide consistent keep-alives, granular timeouts, dns caching, and proxy support.

Usage

const { getAgent, HttpAgent } = require('@npmcli/agent')
const fetch = require('minipass-fetch')

const main = async () => {
    // if you know what agent you need, you can create one directly
    const agent = new HttpAgent(agentOptions)
    // or you can use the getAgent helper, it will determine and create an Agent
    // instance for you as well as reuse that agent for new requests as appropriate
    const agent = getAgent('https://registry.npmjs.org/npm', agentOptions)
    // minipass-fetch is just an example, this will work for any http client that
    // supports node's Agents
    const res = await fetch('https://registry.npmjs.org/npm', { agent })
}

main()

Options

All options supported by the node Agent implementations are supported here, see the docs for those.

Options that have been added by this module include:

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80