1.0.0 • Published 8 years ago

certificate-expiry v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
8 years ago

certificate-expiry

Check when a certificate for a domain expires.

Installation

npm install certificate-expiry

Usage

const cert = require('certificate-expiry');

cert.daysLeft('bbc.co.uk', (err, daysLeft) => {
  console.log(daysLeft);
});
const cert = require('certificate-expiry');

cert.expiresIn('bbc.co.uk', 'hours', (err, hoursLeft) => {
  console.log(hoursLeft);
});

API

cert.daysLeft(host, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • callback - returns an error or the number of days until the certificate expires as an integer. (example: 104)

cert.expiresOn(host, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • callback - returns an error or the date of expiry as a string. (example: '2017-03-15T17:01:06+00:00')

cert.expiresIn(host, unit, callback)

  • host - the host for the certificate you want to check. (example: 'bbc.co.uk' or 'google.com')
  • unit - optional - unit of measurement as string. Accepts same units as moment duration create. If this argument is omitted a moment duration object is returned in the callback. (example: 'days', 'hours', 'minutes')
  • callback - returns an error or the number of units left until the certificate expires. (example: 92) If a unit is not specified the return value is a moment duration object.