Socket
Socket
Sign inDemoInstall

https-browserify

Package Overview
Dependencies
0
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

https-browserify

https module compatability for browserify


Version published
Maintainers
3
Weekly downloads
8,022,276
decreased by-9.28%

Weekly downloads

Package description

What is https-browserify?

The https-browserify package is a browser-friendly implementation of the Node.js HTTPS module. It allows developers to make HTTPS requests in environments where the native Node.js HTTPS module is not available, such as in web browsers. This package is particularly useful for creating web applications that need to interact with secure APIs or perform any secure web requests without relying on server-side proxies.

What are https-browserify's main functionalities?

Making HTTPS GET requests

This code sample demonstrates how to make a simple HTTPS GET request to a specified URL and handle the response. It logs the status code and headers of the response, and then processes the data received.

const https = require('https-browserify');
https.get('https://example.com', function(res) {
  console.log('statusCode:', res.statusCode);
  console.log('headers:', res.headers);

  res.on('data', function(d) {
    process.stdout.write(d);
  });
}).on('error', function(e) {
  console.error(e);
});

Making HTTPS POST requests

This code sample shows how to make an HTTPS POST request with a JSON payload. It sets up the request options including the method, headers, and body data, then sends the request to the server.

const https = require('https-browserify');
const data = JSON.stringify({
  todo: 'Buy the milk'
});

const options = {
  hostname: 'example.com',
  port: 443,
  path: '/todos',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length
  }
};

const req = https.request(options, (res) => {
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    process.stdout.write(d);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();

Other packages similar to https-browserify

Readme

Source

https-browserify

https module compatability for browserify

example

var https = require('https-browserify')
var r = https.request('https://github.com')
r.on('request', function (res) {
  console.log(res)
})

methods

The API is the same as the client portion of the node core https module.

license

MIT

Keywords

FAQs

Last updated on 04 Apr 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc