/ student-intifada / node_modules / @npmcli / agent /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]lib/a year ago -  
[DIR]node_modules/a year ago -  
[TXT]README.mda year ago1.9K595aea1 more query options + view options [كارل مبارك]
[   ]package.jsona year ago1.5Kafd0ccc remove unused [كارل مبارك]
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