eu-domain-checker
v1.0.2
Published
Tool for checking .eu domain status (i.e availability) periodically via eurid.eu API.
Downloads
1
Readme
eu-domain-checker
Tool for checking .eu
domain status (i.e availability) periodically via eurid.eu
API.
Installation
npm i eu-domain-checker
Sample usage:
Check domain every midnight until desired status (default: 'AVAILABLE') is met.
const EuDomainChecker = require('eu-domain-checker');
const exampleChecker = new EuDomainChecker('example.eu'); //.eu extension is optional;
exampleChecker
.check() // using default options
.then(console.log)
.catch(console.error);
API
EuDomainChecker(domainName)
- domainName required
String
- Domain name to check..eu
extension is optional.
.check({status, cronExpression})
-> Promise
- status optional
String
- Status to check against (one of: 'AVAILABLE', 'NOT_AVAILABLE', 'NOT_ALLOWED')
Default value:'AVAILABLE'
- cronExpression optional
String
- Standard cron expression for describing the desired schedule. This might be helpful: crontab.guru. You can also check out cron package documentation.
Default value:'0 0 * * *'
(every midnight)
.checkOnce()
-> Promise
A single one time query to get domain status info (no scheduling).
Example:
new EuDomainChecker('example.eu')
.checkOnce()
.then(console.log)
.catch(console.error);
/* {
"name": "example.eu",
"nameAscii": "example.eu",
"status": "NOT_AVAILABLE",
"lastModified": null
} */
.isAvailable()
-> Promise
Same as checkOnce() but returns a boolean if promise resolves.
Example:
new EuDomainChecker('example.eu')
.isAvailable()
.then(console.log)
.catch(console.error); // false