A top-level domain (TLD) is one of the domains at the highest level in the hierarchical Domain Name System of the Internet.
Primary TLD data are offered via idata/tld
, while idata/tld2
will directly return an array of typed top-level domains.
// Obtain all TLDs with basic information (e.g. domain, type and manager).
const tld = require('idata/tld');
tld.find(element => element.domain == '.com');
// Obtain typed TLDs in domain.
const tld2 = require('idata/tld2');
tld2('ccTLD');
// [ ..., '.cn', ... '.uk', ... ]
Primitive data are downloaded from iana, Root Zone Database.
idata/tld
is a JSON.
// JSON Array.
[
// Each item is made up by 3 properties:
{
/* string */ domain,
/* ENUM */ type,
/* string */ manager,
},
// ...
]
-
string domain
Top-level domain in lowercase, prefixed with a dot signal.
ATTENTION: Some domains are NOT made up of latin-1 characters (e.g..组织机构
). -
ENUM type
A singal word or hyphen-connected in lower-case, representing the domain's type.
Which may be one of the following:- country-code
- generic
- generic-restricted
- infrastructure
- sponsored
- test
See section Types for details.
-
string manager
- object[] tld()
- string[] tld(string typename)
Typenames available for tld2(typename)
include:
-
ARPA | infrastructure
The only one belonging to this type is.apra
. -
ccTLD | country-code | cc
cn
,jp
,ge
etc. -
gTLD | generic | g
.com
,.org
etc. -
grTLD | generic-restricted | gr
.biz
,.name
etc. -
sTLD | sponsored | s
Those sponsored by some organizations or companies. E.g.,.asia
is managed by DotAsia Organisation Ltd.. -
tTLD | test | t
Those for test usage only.
- iana, Root Zone Database
- WIKIPEDIA, Top-level domain