npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

x509-certificate

v1.1.1

Published

Retrieve the public TLS certificate in x509 format from a distant host

Downloads

5

Readme

node-x509-certificate

Retrieve the public TLS certificate in x509 format from a distant host

npm

npm install x509-certificate --save

usage

getCertificate(port, host, callback)

getCertificate(443, 'redsmin.com', (err, certificate) => {
  if(err){
    throw err;
  }

  console.log(certificate); // x509 certificate
});
  • host: host the client should connect to
  • port: port the client should connect to
  • callback(err: {Error,Null}, certificate: String)

getCertificate(port, host, options, callback)


getCertificate(443, 'my-very-own-sni-host.com', {
  rejectUnauthorized: true,
  servername: 'my-very-own-sni-host.com'
}, (err, certificate) => {
  if(err){
    throw err;
  }

  console.log(certificate); // x509 certificate
});
  • option object is the same as tls.connect option object

cli

> npm i x509-certificate -g
> x509-certificate redsmin.com:443

-----BEGIN CERTIFICATE-----
MIIGTzCCBTegAwIBAgIRAKxlFKZ9eTAZfc5c8P1qv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