Last active
May 24, 2022 06:39
-
-
Save jhmaster2000/1acf6669efaf19ad13b4eebc9d12182b to your computer and use it in GitHub Desktop.
IANA TLD List Fetcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import got from 'got'; // npm install got | |
got.get('https://data.iana.org/TLD/tlds-alpha-by-domain.txt').then(response => { | |
const listData = response.body.split('\n'); | |
const listVersion = listData.shift()!.slice(2); | |
listData.pop(); | |
fs.writeFileSync('./tlds.json', JSON.stringify({ version: listVersion, tlds: listData })); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment