parse is deprecated

This commit is contained in:
Kyle McNally 2024-07-17 09:50:09 -04:00
parent b63114df4b
commit 8037abb918
1 changed files with 2 additions and 3 deletions

View File

@ -1,10 +1,9 @@
import { https } from "follow-redirects"; import { https } from "follow-redirects";
import { unlink } from "node:fs"; import { unlink } from "node:fs";
import { tmpdir } from "node:os"; import { tmpdir } from "node:os";
import { type UrlWithStringQuery, parse } from "node:url";
import { extract } from "tar-fs"; import { extract } from "tar-fs";
interface FollowRedirOptions extends UrlWithStringQuery { interface FollowRedirOptions extends URL {
maxBodyLength: number; maxBodyLength: number;
} }
@ -56,7 +55,7 @@ export const isRunningInAwsLambdaNode20 = () => {
export const downloadAndExtract = async (url: string) => export const downloadAndExtract = async (url: string) =>
new Promise<string>((resolve, reject) => { new Promise<string>((resolve, reject) => {
const getOptions = parse(url) as FollowRedirOptions; const getOptions = new URL(url) as FollowRedirOptions;
getOptions.maxBodyLength = 60 * 1024 * 1024; // 60mb getOptions.maxBodyLength = 60 * 1024 * 1024; // 60mb
const destinationDirectory = `${tmpdir()}/chromium-pack`; const destinationDirectory = `${tmpdir()}/chromium-pack`;
const extractObject = extract(destinationDirectory); const extractObject = extract(destinationDirectory);