domain-availablity-checker
Version:
Simple domain availability checker
67 lines (48 loc) • 1.55 kB
Markdown
# Check Domain
This module provides functionality to check the availability of a domain using WHOIS and RDAP servers.
## Installation
1. Ensure you have Node.js installed.
2. Install the package by running:
```sh
npm install domain-availablity-checker
```
## Usage
Require the `checkDomain` function in your project:
```js
const checkDomain = require('domain-availablity-checker');
```
Call the `checkDomain` function with the domain you want to check:
```js
checkDomain('example.com')
.then(result => {
console.log(result);
});
.catch(e=>console.log(e))
```
## Output
The `checkDomain` function returns an object with the following structure:
```js
{
"domain": "example.com",
"available": true,
"message": "✅ The domain is available."
}
```
- `domain`: The domain name that was checked.
- `available`: A boolean indicating whether the domain is available.
- `message`: A message describing the result of the domain check.
## Error Handling
If an error occurs during the domain check, the function will return an object with the following structure:
```js
{
"domain": "example.com",
"available": false,
"message": "⚠️ An error occurred while checking the domain."
}
```
- `error`: A boolean indicating an error occurred.
- `message`: A message describing the error.
## Dependencies
- `whois`: A library for performing WHOIS lookups.
- `util`: A Node.js utility module.
- `axios`: A promise-based HTTP client for making requests.