diff --git a/bin/al.2023.tar.br b/bin/al.2023.tar.br new file mode 100644 index 0000000..78558e4 Binary files /dev/null and b/bin/al.2023.tar.br differ diff --git a/bin/aws.tar.br b/bin/aws.tar.br index 1fb68a5..ab8e70e 100644 Binary files a/bin/aws.tar.br and b/bin/aws.tar.br differ diff --git a/source/helper.ts b/source/helper.ts index 97cc36d..1bad909 100644 --- a/source/helper.ts +++ b/source/helper.ts @@ -4,6 +4,7 @@ import { tmpdir } from "node:os"; import { extract } from "tar-fs"; import { parse } from "node:url"; import type { UrlWithStringQuery } from "node:url"; +import { version } from "node:process"; interface FollowRedirOptions extends UrlWithStringQuery { maxBodyLength: number; @@ -38,6 +39,13 @@ export const isRunningInAwsLambda = () => { return false; }; +export const isRunningInAwsLambdaNode20 = () => { + if (version.startsWith("v20")) { + return true; + } + return false; +}; + export const downloadAndExtract = async (url: string) => new Promise((resolve, reject) => { const getOptions = parse(url) as FollowRedirOptions; diff --git a/source/index.ts b/source/index.ts index 79a5e63..52b59a6 100644 --- a/source/index.ts +++ b/source/index.ts @@ -9,7 +9,12 @@ import { https } from "follow-redirects"; import LambdaFS from "./lambdafs"; import { join } from "node:path"; import { URL } from "node:url"; -import { downloadAndExtract, isRunningInAwsLambda, isValidUrl } from "./helper"; +import { + downloadAndExtract, + isRunningInAwsLambda, + isValidUrl, + isRunningInAwsLambdaNode20, +} from "./helper"; /** Viewport taken from https://github.com/puppeteer/puppeteer/blob/main/docs/api/puppeteer.viewport.md */ interface Viewport { @@ -308,6 +313,9 @@ class Chromium { if (isRunningInAwsLambda()) { // If running in AWS Lambda, extract more required files promises.push(LambdaFS.inflate(`${input}/aws.tar.br`)); + if (isRunningInAwsLambdaNode20()) { + promises.push(LambdaFS.inflate(`${input}/al.2023.tar.br`)); + } } // Await all extractions