1 | var __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 | };
|
10 | import { ok } from "assert";
|
11 | import fetch from "node-fetch";
|
12 | import { FETCH_PSL_EXPECTED_MIN_LENGTH, PUBLIC_SUFFIX_URL } from "../config";
|
13 | export 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 |
|
17 | ok(pslContent.length >= FETCH_PSL_EXPECTED_MIN_LENGTH, "Public suffix list is shorter than expected");
|
18 | return pslContent;
|
19 | });
|
20 |
|
\ | No newline at end of file |