npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

available-domains

v2.0.0

Published

Detect available domains from provided entries

Downloads

5

Readme

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.