"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.downloadHtml = void 0;
const follow_redirects_1 = require("follow-redirects");
const downloadHtml = (url) => {
    return new Promise((resolve, reject) => {
        const protocol = url.startsWith('https') ? follow_redirects_1.https : follow_redirects_1.http;
        protocol.get(url, (response) => {
            let data = '';
            response.setEncoding('utf8');
            response.on('data', (chunk) => {
                data += chunk;
            });
            response.on('end', () => {
                resolve(data);
            });
            response.on('error', reject);
        });
    });
};
exports.downloadHtml = downloadHtml;
