publicsuffix-data
v2.0.1
Published
Wrapper around the Public Suffix List https://publicsuffix.org/
Downloads
11
Readme
publicsuffix-data
Module for accessing the publicsuffix.org database for TLDs
Installing
Install using npm:
npm install --save publicsuffix-data
Description
Maintains an infrequently-updated copy of the Public Suffix List and an API to query this data.
Other modules for accessing static copies of the data already exist. See these modules if you do not need an automatically-updating database:
Usage
const PublicSuffixData = require('publicsuffix-data');
const publicSuffixData = new PublicSuffixData({
tts: timeToStaleInSeconds, // Seconds until the next fetch of data will occur. Defaults to 10 days (864,000).
ttl: timeToLiveInSeconds, // Seconds until old data becomes invalid. Defaults to 30 days (2,592,000).
cache: cacheFileLocation // Defaults to ~/.publicsuffix.org
});
const result = await publicSuffixData.getTLD('foo.example.com');
console.log(result); // "com"