Skip to content

DullReferenceException/node-publicsuffix-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

About

Wrapper around the Public Suffix List https://publicsuffix.org/

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published