chore: remove cjs require in favor of new esm import method

This commit is contained in:
2025-03-21 02:16:08 -07:00
parent eee25769c8
commit 074fbe67d8

View File

@@ -246,7 +246,7 @@ async function downloadFile(url, filePath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const isHttps = new URL(url).protocol === 'https:'; const isHttps = new URL(url).protocol === 'https:';
const httpModule = isHttps ? require('https') : require('http'); const httpModule = isHttps ? https : http;
const file = fs.createWriteStream(filePath); const file = fs.createWriteStream(filePath);
httpModule httpModule
@@ -294,7 +294,7 @@ async function ensureFileExists(url, filePath) {
// TODO: UPDATES TO HANDLER FOR SPORT EVENTS // TODO: UPDATES TO HANDLER FOR SPORT EVENTS
async function fetchSportsData() { async function fetchSportsData() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const isHttps = new URL(externalEvents).protocol === 'https:'; const isHttps = new URL(extEvents).protocol === 'https:';
const httpModule = isHttps ? require('https') : require('http'); const httpModule = isHttps ? require('https') : require('http');
httpModule httpModule
.get(url, (response) => { .get(url, (response) => {