• Version 7.1.1
  • Published
  • 31.2 kB
  • 1 dependency
  • MIT license


npm i agent-base
yarn add agent-base
pnpm add agent-base


Turn a function into an `http.Agent` instance



variable INTERNAL

const INTERNAL: Symbol;


    function json

    json: (stream: Readable) => Promise<any>;

      function req

      req: (url: string | URL, opts?: https.RequestOptions) => ThenableRequest;

        function toBuffer

        toBuffer: (stream: Readable) => Promise<Buffer>;


          class Agent

          abstract class Agent extends http.Agent {}


            constructor(opts?: http.AgentOptions);

              property defaultPort

              defaultPort: number;

                property keepAlive

                keepAlive: boolean;

                  property options

                  options: Partial<any>;

                    property protocol

                    protocol: string;

                      method connect

                      abstract connect: (
                      req: http.ClientRequest,
                      options: AgentConnectOpts
                      ) => Promise<Duplex | http.Agent> | Duplex | http.Agent;

                        method createConnection

                        createConnection: () => Duplex;

                          method createSocket

                          createSocket: (
                          req: http.ClientRequest,
                          options: AgentConnectOpts,
                          cb: (err: Error | null, s?: Duplex) => void
                          ) => void;

                            method getName

                            getName: (options: AgentConnectOpts) => string;

                              method isSecureEndpoint

                              isSecureEndpoint: (options?: AgentConnectOpts) => boolean;
                              • Determine whether this is an http or https request.

                              Type Aliases

                              type AgentConnectOpts

                              type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;

                                type ThenableRequest

                                type ThenableRequest = http.ClientRequest & {
                                then: Promise<http.IncomingMessage>['then'];

                                  Package Files (2)

                                  Dependencies (1)

                                  Dev Dependencies (11)

                                  Peer Dependencies (0)

                                  No peer dependencies.


                                  To add a badge like this badgeto your package's README, use the codes available below.

                                  You may also use to create a custom badge linking to

                                  • Markdown
                                  • HTML
                                    <a href=""><img src="" alt=""></a>