Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hpagent

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hpagent

A ready to use http and https agent for working with proxies that keeps connections alive!

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
decreased by-15.07%
Maintainers
1
Weekly downloads
 
Created

What is hpagent?

The hpagent npm package provides HTTP and HTTPS agents optimized for HTTP/1.1 keep-alive connections. It is designed to improve performance by reusing TCP connections for multiple requests, reducing latency and resource consumption.

What are hpagent's main functionalities?

HTTP Agent

This feature allows you to create an HTTP agent that uses a proxy server. The agent is configured to keep connections alive, which can improve performance by reusing TCP connections.

const { HttpProxyAgent } = require('hpagent');
const http = require('http');

const agent = new HttpProxyAgent({
  keepAlive: true,
  keepAliveMsecs: 1000,
  maxSockets: 256,
  maxFreeSockets: 256,
  proxy: 'http://localhost:8080'
});

http.get('http://example.com', { agent }, (res) => {
  res.on('data', (chunk) => {
    console.log(chunk.toString());
  });
});

HTTPS Agent

This feature allows you to create an HTTPS agent that uses a proxy server. Similar to the HTTP agent, it is configured to keep connections alive for better performance.

const { HttpsProxyAgent } = require('hpagent');
const https = require('https');

const agent = new HttpsProxyAgent({
  keepAlive: true,
  keepAliveMsecs: 1000,
  maxSockets: 256,
  maxFreeSockets: 256,
  proxy: 'http://localhost:8080'
});

https.get('https://example.com', { agent }, (res) => {
  res.on('data', (chunk) => {
    console.log(chunk.toString());
  });
});

Other packages similar to hpagent

Keywords

FAQs

Package last updated on 29 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc