Check when a certificate for a domain expires.
npm install certificate-expiry
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);
});
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)
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')
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 thecallback
. (example: 'days', 'hours', 'minutes')callback
- returns an error or the number ofunit
s left until the certificate expires. (example: 92) If aunit
is not specified the return value is a moment duration object.