UNPKG

1.19 kBJavaScriptView Raw
1var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3 return new (P || (P = Promise))(function (resolve, reject) {
4 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7 step((generator = generator.apply(thisArg, _arguments || [])).next());
8 });
9};
10import { ok } from "assert";
11import fetch from "node-fetch";
12import { FETCH_PSL_EXPECTED_MIN_LENGTH, PUBLIC_SUFFIX_URL } from "../config";
13export const fetchPsl = () => __awaiter(void 0, void 0, void 0, function* () {
14 const response = yield fetch(PUBLIC_SUFFIX_URL);
15 const pslContent = yield response.text();
16 // Sanity check
17 ok(pslContent.length >= FETCH_PSL_EXPECTED_MIN_LENGTH, "Public suffix list is shorter than expected");
18 return pslContent;
19});
20//# sourceMappingURL=fetch-psl.js.map
\No newline at end of file