{"_id":"@aqaurius6666/chromium","_rev":"1-3e9470e0920da9656d2072e121684aa6","name":"@aqaurius6666/chromium","dist-tags":{"latest":"109.0.1"},"versions":{"109.0.0":{"name":"@aqaurius6666/chromium","version":"109.0.0","author":{"name":"Vu Nguyen"},"license":"MIT","description":"Chromium Binary for Serverless Platforms","main":"build/index.js","types":"build/index.d.ts","engines":{"node":">= 14"},"scripts":{"test":"make clean && make && make pretest && make test","build":"rm -rf build && tsc -p tsconfig.json","postversion":"git push && git push --tags && npm publish","prepack":"npm run build","preversion":"npm run build"},"devDependencies":{"@types/node":"^16.11.62","@types/tar-fs":"^2.0.1","clean-modules":"^2.0.6","typescript":"^4.8.3"},"bugs":{"url":"https://github.com/aqaurius6666/chromium/issues"},"homepage":"https://github.com/aqaurius6666/chromium","repository":{"type":"git","url":"git://github.com/aqaurius6666/chromium.git"},"keywords":["aws","browser","chrome","chromium","lambda","puppeteer","playwright","serverless"],"prettier":{"arrowParens":"always","bracketSpacing":true,"jsxBracketSameLine":false,"printWidth":140,"semi":true,"singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"dependencies":{"tar-fs":"^2.1.1"},"gitHead":"d947fd424c074a5cc4f17a4dc142a96afcda8b20","_id":"@aqaurius6666/chromium@109.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-QIWxDgkC/W5zVKFJ1ICY/O5j8FwYKuhrgSo8PlIJ8U2x63BAkLCWY/RqpB+jUlMwokSy8QEyj/3X/ucq/4uz5g==","shasum":"125809f3992dbdfc68b292345724cdef2ef67c9f","tarball":"https://registry.npmjs.org/@aqaurius6666/chromium/-/chromium-109.0.0.tgz","fileCount":12,"unpackedSize":58119919,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVrIjXb65E13s98JgJ+y+EGZeqcxwum1/c9iG9MamD6AIhAILcLLhZmN0NqEtj5yWloISVAi201DHpAI1rykFQ0ywJ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjqqMdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrssA/9F7BIvAg+/zbFYlKuNuim+ZJpqUcJmQRZosHkvXe5QeC/JKUA\r\nxOCoZky0OomDgF5qrp7hVVQZCs1bE5Gp1RhgHK9fqD8TZTMESGBJPZYQV1XI\r\nBI/H7WWyOWs1QroPlVvMH0JbRECB6npRPNMJTgdv72wJMn++R32F4F2+fw+u\r\nRTONZZBaNcVV4//vKcQcVQE3kbUV5DSHueLAICduITrI5ZQUFVP7/1Jy/sWq\r\nebphni2DNbwQX7PkXFA+pk7eBY2tqtgAOc3OoG6ob+WSOY9MsUbNWHnWNNz4\r\ny1qRuM3EFvrzy5v142cTxnu3Ixyr/WZrEbUI/ZPQDdGZ8vq0UjHtWV61rX3g\r\ny0c0Jjj0zv+7hvIg8XfmhXhJFZ0ZBxOiyDsVsapuYYgEgoPgOmBaXrpvnNEc\r\nP5Q9h68E0FEkGzav5OpJ1yIYThyCwElbFFhVx1itYM8D4tNXbZ3Rn7h5nMGl\r\nFkqFVGr4tjflipZYpZuA4ittrssh23LePGyk8GHW1wt5QdunxnJxFScftb6B\r\nsSoZ4p84CBhwC2VLfu/pkSsej5U6L9Gl94AuVgOBY0x27WBtsWUezgltHhlT\r\nxsb0LLxQaR59RAJWwa2IKWYgmV/9pFJK7hG1d6sGNjyM6hqgoY6ZacU+6fiO\r\n583P//NvDlExktSpu46jInsASJBSBk9kh/o=\r\n=aQsr\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aqaurius6666","email":"aqaurius6666@gmail.com"},"directories":{},"maintainers":[{"name":"aqaurius6666","email":"aqaurius6666@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chromium_109.0.0_1672127260577_0.6640577630465923"},"_hasShrinkwrap":false},"109.0.1":{"name":"@aqaurius6666/chromium","version":"109.0.1","author":{"name":"Vu Nguyen"},"license":"MIT","description":"Chromium Binary for Serverless Platforms","main":"build/index.js","types":"build/index.d.ts","engines":{"node":">= 14"},"scripts":{"test":"make clean && make && make pretest && make test","build":"rm -rf build && tsc -p tsconfig.json","postversion":"git push && git push --tags && npm publish","prepack":"npm run build","preversion":"npm run build"},"devDependencies":{"@types/node":"^16.11.62","@types/tar-fs":"^2.0.1","clean-modules":"^2.0.6","typescript":"^4.8.3"},"bugs":{"url":"https://github.com/aqaurius6666/chromium/issues"},"homepage":"https://github.com/aqaurius6666/chromium","repository":{"type":"git","url":"git://github.com/aqaurius6666/chromium.git"},"keywords":["aws","browser","chrome","chromium","lambda","puppeteer","playwright","serverless"],"prettier":{"arrowParens":"always","bracketSpacing":true,"jsxBracketSameLine":false,"printWidth":140,"semi":true,"singleQuote":true,"tabWidth":2,"trailingComma":"es5","useTabs":false},"dependencies":{"tar-fs":"^2.1.1"},"gitHead":"29049787ecfc18196b6f355999f2cc055c0b69c4","_id":"@aqaurius6666/chromium@109.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-RMXXxgJFI7/t3bBTnLYMT+VFRKq0+DFfOwodP2yXOuLtxBsEymkH+//BL+2uJDYwzQkEYEZmBH/lluffgn0nLQ==","shasum":"e57226af2a661b081c118f27bdd29ce15156ce1d","tarball":"https://registry.npmjs.org/@aqaurius6666/chromium/-/chromium-109.0.1.tgz","fileCount":12,"unpackedSize":58120165,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCSYlzvyztyFPP0OmfgaFL9FzCcGzZPkuAeIJhXq4e3AQIgNBisOZaRSPwBz1cs70iHdtQqL8ngnP4Vf5RPkUp8lKE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjrBtGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqjbxAAnaPV5lPDx8uegu+PFXkJXtHpEARkQ3+Mh4IakSF8PKX/K9d2\r\nQ/KH6etYm4WHQiOL+romHEOmkeo5XXeaDNWxtQqyz4nfVeP0cE9HuA508fyW\r\nSk1R7f5mEGQGf/EtfFGI5c32t5F9BM3QrTNxUhnWQRxfnP+EWeb2WvdeEpKH\r\nNg2Uc5WxE/PIfCvku+MNjHptUevuIN0ni+M1oEGdQZDIZ40mBglHYT79beTl\r\n8ijdW2+Sbn0b00Et29p6AxCURg6zIvZtb5sBSPblgtCSoG43EBaMwBBfguaI\r\nWSl4Y0szYBVpkgTL1bD6UHONF7PkP9lp+TUWop8SI+DkyXhxSE/ybM6/3hPf\r\nAYcfmkLKDBbUlA0NHaWjUATHkSpoRIx3smvOoY02UWiPdjDro1klbiwz427o\r\nVvH5J4RqlRTV+V9v2vRIura9/FL0KPd38FqkfYb7xggOE0935e420pxxAo7y\r\n06EpmOVXamgQWkXmcickYT7UaiggnR0YsnH9rrGabFrUZWaL/dAEq06ahqEa\r\nkYU2vp5bBVUnxGHWCafaG4sY5E4P7e+qJ3ZVT5k/J6njaXos7Z7zxNiWrSte\r\nQC0ykNhCRrbGlQkvmHonhpseoRDKzA2McSdxAv7gVTLtrW+O5y4aTrkvqKlC\r\nVnVqYwVwtAIACGr1M0LPRUhMlXf+p1JLxQM=\r\n=6/kH\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aqaurius6666","email":"aqaurius6666@gmail.com"},"directories":{},"maintainers":[{"name":"aqaurius6666","email":"aqaurius6666@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chromium_109.0.1_1672223557881_0.28899198924026903"},"_hasShrinkwrap":false}},"time":{"created":"2022-12-27T07:47:40.505Z","109.0.0":"2022-12-27T07:47:41.339Z","modified":"2022-12-28T10:32:38.943Z","109.0.1":"2022-12-28T10:32:38.760Z"},"maintainers":[{"name":"aqaurius6666","email":"aqaurius6666@gmail.com"}],"description":"Chromium Binary for Serverless Platforms","homepage":"https://github.com/aqaurius6666/chromium","keywords":["aws","browser","chrome","chromium","lambda","puppeteer","playwright","serverless"],"repository":{"type":"git","url":"git://github.com/aqaurius6666/chromium.git"},"author":{"name":"Vu Nguyen"},"bugs":{"url":"https://github.com/aqaurius6666/chromium/issues"},"license":"MIT","readme":"# @sparticuz/chromium\n\n[![@sparticuz/chromium](https://img.shields.io/npm/v/@sparticuz/chromium.svg?style=for-the-badge)](https://www.npmjs.com/package/@sparticuz/chromium)\n[![TypeScript](https://img.shields.io/npm/types/chrome-aws-lambda?style=for-the-badge)](https://www.typescriptlang.org/dt/search?search=chromium)\n[![Chromium](https://img.shields.io/badge/chromium-51_MB-brightgreen.svg?style=for-the-badge)](bin/)\n[![Donate](https://img.shields.io/badge/donate-paypal-orange.svg?style=for-the-badge)](https://paypal.me/sparticuz)\n\n## Chromium for Serverless platforms\n\nThis package was originally forked from [alixaxel/chrome-aws-lambda#264](https://github.com/alixaxel/chrome-aws-lambda/pull/264).\nThe biggest difference, besides the chromium version, is the inclusion of some code from https://github.com/alixaxel/lambdafs,\nas well as dropping that as a dependency. Due to some changes in WebGL, the files in bin/swiftshader.tar.br need to\nbe extracted to `/tmp` instead of `/tmp/swiftshader`. This necessitated changes in lambdafs.\n\nHowever, it quickly became difficult to maintain because of the pace of `puppeteer` updates. This package, `@sparticuz/chromium`,\nis not chained to `puppeteer` versions, but also does not include the overrides and hooks that the original package contained. It is only `chromium`, as well as the special code needed to decompress the brotli package.\n\n## Install\n\n[`puppeteer` ships with a prefered version of `chromium`](https://pptr.dev/faq/#q-why-doesnt-puppeteer-vxxx-work-with-chromium-vyyy).\nIn order to figure out what version of `@sparticuz/chromium` you will need, please visit [Puppeteer's Chromium Support page](https://pptr.dev/chromium-support).\n\n> For example, as of today, the latest version of `puppeteer` is `18.0.5`. The latest version of `chromium` stated on `puppeteer`'s support page is `106.0.5249.0`. So you need to install `@sparticuz/chromium@106`.\n\n```shell\n# Puppeteer or Playwright is a production dependency\nnpm install --save puppeteer-core@$PUPPETEER_VERSION\n# @sparticuz/chromium is a DEV dependency IF YOU ARE USING A LAYER, if not, use as a production dependency!\nnpm install --save-dev @sparticuz/chromium@$CHROMIUM_VERSION\n```\n\nIf you wish to install an older version of Chromium, take a look at [@sparticuz/chrome-aws-lambda](https://github.com/Sparticuz/chrome-aws-lambda#versioning) or [@alixaxel/chrome-aws-lambda](https://github.com/alixaxel/chrome-aws-lambda).\n\n## Versioning\n\nThe @sparticuz/chromium version schema is as follows:\n`MajorChromiumVersion.MinorChromiumIncrement.@Sparticuz/chromiumPatchLevel`\n\n## Usage\n\nThis package works with all the currently supported AWS Lambda Node.js runtimes out of the box.\n\n```javascript\nconst test = require(\"node:test\");\nconst puppeteer = require(\"puppeteer-core\");\nconst chromium = require(\"@sparticuz/chromium\");\n\ntest(\"Check the page title of example.com\", async (t) => {\n  const browser = await puppeteer.launch({\n    args: chromium.args,\n    defaultViewport: chromium.defaultViewport,\n    executablePath: await chromium.executablePath(),\n    headless: chromium.headless,\n    ignoreHTTPSErrors: true,\n  });\n\n  const page = await browser.newPage();\n  await page.goto(\"https://example.com\");\n  const pageTitle = await page.title();\n  await browser.close();\n\n  assert.strictEqual(pageTitle, \"Example Domain\");\n});\n```\n\n### Usage with Playwright\n\n```javascript\nconst test = require(\"node:test\");\n// Need to rename playwright's chromium object to something else\nconst { chromium: playwright } = require('playwright-core');\nconst chromium = require('@sparticuz/chromium');\n\ntest(\"Check the page title of example.com\", async (t) => {\n  const browser = await playwright.launch({\n    args: chromium.args,\n    executablePath: await chromium.executablePath(),\n    headless: chromium.headless,\n  });\n\n  const context = await browser.newContext();\n  const page = await context.newPage();\n  await page.goto(\"https://example.com\");\n  const pageTitle = await page.title();\n  await browser.close();\n\n  assert.strictEqual(pageTitle, \"Example Domain\");\n});\n```\n\nYou should allocate at least 512 MB of RAM to your Lambda, however 1600 MB (or more) is recommended.\n\n### Running Locally\n\nThis package will run in headless mode when `NODE_ENV = \"test\"`. If you want to run using your own local binary, set `IS_LOCAL` to anything.\n\n## API\n\n| Method / Property | Returns              | Description                                                                                                                                             |\n| ----------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `font(url)`       | `{?Promise<string>}` | Provisions a custom font and returns its basename.                                                                                                      |\n| `args`            | `{!Array<string>}`   | Provides a list of recommended additional [Chromium flags](https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md). |\n| `defaultViewport` | `{!Object}`          | Returns more sensible default viewport settings.                                                                                                        |\n| `executablePath`  | `{?Promise<string>}` | Returns the path the Chromium binary was extracted to.                                                                                                  |\n| `headless`        | `{!boolean}`         | Returns `true` if we are running on AWS Lambda or GCF.                                                                                                  |\n\n## Fonts\n\nThe Amazon Linux 2 AWS Lambda runtime is no longer provisioned with any font faces.\n\nBecause of this, this package ships with [Open Sans](https://fonts.google.com/specimen/Open+Sans), which supports the following scripts:\n\n* Latin\n* Greek\n* Cyrillic\n\nTo provision additional fonts, simply call the `font()` method with an absolute path or URL:\n\n```typescript\nawait chromium.font('/var/task/fonts/NotoColorEmoji.ttf');\n// or\nawait chromium.font('https://raw.githack.com/googlei18n/noto-emoji/master/fonts/NotoColorEmoji.ttf');\n```\n\n> `Noto Color Emoji` (or similar) is needed if you want to [render emojis](https://getemoji.com/).\n\n> For URLs, it's recommended that you use a CDN, like [raw.githack.com](https://raw.githack.com/) or [gitcdn.xyz](https://gitcdn.xyz/).\n\nThis method should be invoked _before_ launching Chromium.\n\n> On non-serverless environments, the `font()` method is a no-op to avoid polluting the user space.\n\n---\n\nAlternatively, it's also possible to provision fonts via AWS Lambda Layers.\n\nSimply create a directory named `.fonts` and place any font faces you want there:\n\n```\n.fonts\n├── NotoColorEmoji.ttf\n└── Roboto.ttf\n```\n\nAfterwards, you just need to ZIP the directory and upload it as a AWS Lambda Layer:\n\n```shell\nzip -9 --filesync --move --recurse-paths .fonts.zip .fonts/\n```\n## Compiling\n\nTo compile your own version of Chromium check the [Ansible playbook instructions](_/ansible).\n\n## AWS Lambda Layer\n\n[Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) is a convenient way to manage common dependencies between different Lambda Functions.\n\nThe following set of (Linux) commands will create a layer of this package:\n\n```shell\ngit clone --depth=1 https://github.com/sparticuz/chromium.git && \\\ncd chromium && \\\nmake chromium.zip\n```\n\nThe above will create a `chromium.zip` file, which can be uploaded to your Layers console. You can and should upload using the `aws cli`. (Replace the variables with your own values)\n```shell\nbucketName=\"chromiumUploadBucket\" && \\\nversionNumber=\"107\" && \\\naws s3 cp chromium.zip \"s3://${bucketName}/chromiumLayers/chromium${versionNumber}.zip\" && \\\naws lambda publish-layer-version --layer-name chromium --description \"Chromium v${versionNumber}\" --content \"S3Bucket=${bucketName},S3Key=chromiumLayers/chromium${versionNumber}.zip\" --compatible-runtimes nodejs --compatible-architectures x86_64\n```\n\nThen you can specify custom Chromium location as following.\n```javascript\nconst test = require(\"node:test\");\nconst puppeteer = require(\"puppeteer-core\");\nconst chromium = require(\"@sparticuz/chromium\");\n\ntest(\"Check the page title of example.com\", async (t) => {\n  const browser = await puppeteer.launch({\n    args: chromium.args,\n    defaultViewport: chromium.defaultViewport,\n    executablePath: await chromium.executablePath('/opt/chromium'),\n    headless: chromium.headless,\n    ignoreHTTPSErrors: true,\n  });\n\n  const page = await browser.newPage();\n  await page.goto(\"https://example.com\");\n  const pageTitle = await page.title();\n  await browser.close();\n\n  assert.strictEqual(pageTitle, \"Example Domain\");\n});\n```\n\nAlternatively, you can also download the layer artifact from one of our [CI workflow runs](https://github.com/Sparticuz/chromium/actions/workflows/aws.yml?query=is%3Asuccess+branch%3Amaster). Use the `chromium.zip` INSIDE the artifact as the layer. Also, the artifact will expire from Github after a certain time period.\n\n## Google Cloud Functions\n\nSince version `1.11.2`, it's also possible to use this package on Google/Firebase Cloud Functions.\n\nAccording to our benchmarks, it's 40% to 50% faster than using the off-the-shelf `puppeteer` bundle.\n\n## Migration from `chrome-aws-lambda`\n\n- Change the import or require to be `@sparticuz/chromium`\n- Add the import or require for `puppeteer-core`\n- Change the browser launch to use the native `puppeteer.launch()` function\n```diff\n-const chromium = require('@sparticuz/chrome-aws-lambda');\n+const chromium = require(\"@sparticuz/chromium\");\n+const puppeteer = require(\"puppeteer-core\");\n\nexports.handler = async (event, context, callback) => {\n  let result = null;\n  let browser = null;\n\n  try {\n-    browser = await chromium.puppeteer.launch({\n+    browser = await puppeteer.launch({\n      args: chromium.args,\n      defaultViewport: chromium.defaultViewport,\n      executablePath: await chromium.executablePath(),\n      headless: chromium.headless,\n      ignoreHTTPSErrors: true,\n    });\n\n    let page = await browser.newPage();\n\n    await page.goto(event.url || 'https://example.com');\n\n    result = await page.title();\n  } catch (error) {\n    return callback(error);\n  } finally {\n    if (browser !== null) {\n      await browser.close();\n    }\n  }\n\n  return callback(null, result);\n};\n```\n## Compression\n\nThe Chromium binary is compressed using the Brotli algorithm.\n\nThis allows us to get the best compression ratio and faster decompression times.\n\n| File          | Algorithm | Level | Bytes     | MiB       | %          | Inflation  |\n| ------------- | --------- | ----- | --------- | --------- | ---------- | ---------- |\n| `chromium`    | -         | -     | 136964856 | 130.62    | -          | -          |\n| `chromium.gz` | Gzip      | 1     | 51662087  | 49.27     | 62.28%     | 1.035s     |\n| `chromium.gz` | Gzip      | 2     | 50438352  | 48.10     | 63.17%     | 1.016s     |\n| `chromium.gz` | Gzip      | 3     | 49428459  | 47.14     | 63.91%     | 0.968s     |\n| `chromium.gz` | Gzip      | 4     | 47873978  | 45.66     | 65.05%     | 0.950s     |\n| `chromium.gz` | Gzip      | 5     | 46929422  | 44.76     | 65.74%     | 0.938s     |\n| `chromium.gz` | Gzip      | 6     | 46522529  | 44.37     | 66.03%     | 0.919s     |\n| `chromium.gz` | Gzip      | 7     | 46406406  | 44.26     | 66.12%     | 0.917s     |\n| `chromium.gz` | Gzip      | 8     | 46297917  | 44.15     | 66.20%     | 0.916s     |\n| `chromium.gz` | Gzip      | 9     | 46270972  | 44.13     | 66.22%     | 0.968s     |\n| `chromium.gz` | Zopfli    | 10    | 45089161  | 43.00     | 67.08%     | 0.919s     |\n| `chromium.gz` | Zopfli    | 20    | 45085868  | 43.00     | 67.08%     | 0.919s     |\n| `chromium.gz` | Zopfli    | 30    | 45085003  | 43.00     | 67.08%     | 0.925s     |\n| `chromium.gz` | Zopfli    | 40    | 45084328  | 43.00     | 67.08%     | 0.921s     |\n| `chromium.gz` | Zopfli    | 50    | 45084098  | 43.00     | 67.08%     | 0.935s     |\n| `chromium.br` | Brotli    | 0     | 55401211  | 52.83     | 59.55%     | 0.778s     |\n| `chromium.br` | Brotli    | 1     | 54429523  | 51.91     | 60.26%     | 0.757s     |\n| `chromium.br` | Brotli    | 2     | 46436126  | 44.28     | 66.10%     | 0.659s     |\n| `chromium.br` | Brotli    | 3     | 46122033  | 43.99     | 66.33%     | 0.616s     |\n| `chromium.br` | Brotli    | 4     | 45050239  | 42.96     | 67.11%     | 0.692s     |\n| `chromium.br` | Brotli    | 5     | 40813510  | 38.92     | 70.20%     | **0.598s** |\n| `chromium.br` | Brotli    | 6     | 40116951  | 38.26     | 70.71%     | 0.601s     |\n| `chromium.br` | Brotli    | 7     | 39302281  | 37.48     | 71.30%     | 0.615s     |\n| `chromium.br` | Brotli    | 8     | 39038303  | 37.23     | 71.50%     | 0.668s     |\n| `chromium.br` | Brotli    | 9     | 38853994  | 37.05     | 71.63%     | 0.673s     |\n| `chromium.br` | Brotli    | 10    | 36090087  | 34.42     | 73.65%     | 0.765s     |\n| `chromium.br` | Brotli    | 11    | 34820408  | **33.21** | **74.58%** | 0.712s     |\n\n## License\n\nMIT\n","readmeFilename":"README.md"}