available-domains
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

available-domains

Node.js software to detect whether the domain name is available or already taken.

It's fast, stable and provides a simple interface to search through.

Installation

NPM, Yarn or similar is required. Afterwards, you have to install package globally, i.e.:

npm install -g available-domains

Usage

CLI

To find a single or few domains, you may pass them as arguments:

available-domains google.com google.co.uk

Alternatively, you may pass whole file:

available-domains < domains-list.txt

Or pass a result of different command:

cat domains-list.txt | available-domains

The stdout will have only domains line by line, all errors, progress bars etc will land on stderr.

Thanks to that, you may simply stream the results to a different file, while still having all progress information available:

cat domains-list.txt | available-domains > free-domains-list.txt
# or:
available-domains < domains-list.txt > free-domains-list.txt

If you have a lot of domains, and you want to speed up at cost of false-positives, you may use --trust-dns option. It will not be fully accurate, but will be faster.

Usage: available-domains [options] [domains...]

Options:
  -V, --version                                  output the version number
  --concurrency <concurrency>, -c <concurrency>  How many concurrent checks may be performed (default: 30)
  --suffix <suffix>                              Optional suffix(es), helps to add TLDs
  --trust-dns                                    Should it trust ENOTFOUND from DNS (default: false)
  --printTaken, --print-taken, -pt               Should it print taken domains too (with "[T]" prefix) (default: false)
  --timeout <timeout>, -t <timeout>              Timeout for WHOIS connection (ms) (default: 3000)
  --max-retries <maxRetries>, -r <maxRetries>    How many times it may retry rate limited WHOIS query (default: 2)
  --retry-time <retryTime>, -rt <retryTime>      Retry time of WHOIS query when rate limited (ms) (default: 3000)
  --proxy <proxy>, -p <proxy>                    SOCKS Proxy "<ip>:<port>"
  -h, --help                                     Show help information (default: false)

Note:

Because of concurrency, order of results is not guaranteed.

Thanks to piping, you may perform some operations nicely though, i.e.:

cat domains-list.txt | available-domains | sort # Sort alphabetically
cat domains-list.txt | grep -x '.\{0,16\}' | available-domains # Take domains of max 16 characters

Programmatically

There are two functions exposed:

  • isDomainAvailable that returns boolean for specific domain name
  • getAvailableDomains that returns list of available domains (string[]) from provided
const { getAvailableDomains, isDomainAvailable } = require('available-domains');

const result = await isDomainAvailable('google.com');
const list = await getAvailableDomains([ 'google.com', 'google.co.uk' ]);

As the second argument you may provide optional options object.

isDomainAvailable options

Name Type Description Default
proxy string SOCKS Proxy ":" null - no proxy
timeout number Timeout for WHOIS connection (ms) 3000
maxRetries number How many times it may retry rate limited WHOIS query 2
retryTime number Retry time of WHOIS query when rate limited (ms) 3000
trustDns boolean Should it trust ENOTFOUND from DNS false

getAvailableDomains options

It supports same options as isDomainAvailable and additionally:

Name Type Description Default
concurrency number How many concurrent checks may be performed 30
onStatus (domain: string, available: boolean, finishedCount: number) => void Callback to immediately get information about each scanned domain none
onError (domain: string, error: Error, finishedCount: number) => void Callback to immediately get information about each failed domain scan none

How it works

Firstly, it's resolving DNS for the specified domain. It's cheaper, less limited, but not precise.

If there is an DNS record for that domain, it's immediately treat as taken. Otherwise, WHOIS record is obtained to check it this way.

Package Sidebar

Install

npm i available-domains

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

24.2 kB

Total Files

20

Last publish

Collaborators

  • rangoo