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

cert-downloader

v0.2.1

Published

(Apple) SSL certificate downloader

Downloads

1,256

Readme

cert-downloader Build Status

This is a helper module that allows you to download an SSL certificate, by default that of Apple Inc..

Offered functionality:

  • Download certificate and store locally.
  • Convert certificate to PEM format.
  • Validate a file against the certificate.

More information and links to source code: http://evi-snowm.github.io/cert-downloader/

NOTE OpenSSL or compatible must be installed on your system if you wish to use certificates in the PEM format. Without this tool, only the download function will work.

Install

$ npm install cert-downloader

Usage

var CertDownloader = require('cert-downloader');
var certDl = new CertDownloader();

// download and save in default (cache) location
certDl.cert(function (error, certificatePath) {
    if(error) {
        console.error('Error ' + error);
    } else {
        console.log('Certificate downloaded to ' + certificatePath);
        // /nodeproject/certificate/AppleIncRootCertificate.cer
    }
});

// download and convert to PEM (will use cached cer file and convert that to pem)
certDl.pem(function (error, certificatePath) {
    if(error) {
        console.error('Error ' + error);
    } else {
        console.log('Certificate downloaded to ' + certificatePath);
        // /nodeproject/certificate/AppleIncRootCertificate.pem
    }
});

// verifiy an existing file against the certificate
// (will download and convert if required)
var file = '/nodeproject/certificate/file-to-verify';
certDl.verify(file, function(error, output) {
    if(error){
      return callback('File verification failed: ' + error);
    }
    console.log('Verified output: ' + output);
  });

##API

###CertDownloader([options]) Construct a new CertDownloader.

You will always need to call this first. options Overrides one or several defaults and should be in JSON format with any of the following options:

  • certName: name of the certificate (default is AppleIncRootCertificate.cer)
  • url : URL to download the certificate from (default is http://www.apple.com/appleca/AppleIncRootCertificate.cer)
  • cache : path to cache location (a.k.a. where to keep the certificates locally, by default this is the operating system's default directory for temp files)

###cert(callback) Retrieve the certificate.

Attempts to download a missing certificate and returns the path to said certificate if available (either cached or downloaded). The callback gets two arguments (err, path), where path is a string to the location of the certificate.

###pem(callback) Retrieve the certificate in PEM format.

Attempts to download and convert a missing certificate and returns the path to said certificate if available (either cached or converted). The callback gets two arguments (err, path), where path is a string to the location of the certificate.

###verify(file, callback) Verifies a file against the certificate.

Attempts to download and convert a missing certificate and returns the content of the file if successfully verified. The callback gets two arguments (err, output), where output is the content of the file if successfully verified.

License

MIT © Patrick Londema