added an extra environment variable

This commit is contained in:
daniel31x13
2023-12-31 10:46:09 -05:00
parent 29e0370808
commit 4e29330472
7 changed files with 40 additions and 5 deletions
+12 -1
View File
@@ -1,6 +1,17 @@
import fetch from "node-fetch";
import https from "https";
export default async function validateUrlSize(url: string) {
try {
const response = await fetch(url, { method: "HEAD" });
const httpsAgent = new https.Agent({
rejectUnauthorized:
process.env.IGNORE_UNAUTHORIZED_CA === "true" ? false : true,
});
const response = await fetch(url, {
method: "HEAD",
agent: httpsAgent,
});
const totalSizeMB =
Number(response.headers.get("content-length")) / Math.pow(1024, 2);