New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chrome-aws-lambda

Package Overview
Dependencies
Maintainers
1
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-aws-lambda

Chromium Binary for AWS Lambda

  • 1.8.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-15.28%
Maintainers
1
Weekly downloads
 
Created
Source

chrome-aws-lambda

chrome-aws-lambda Chromium Donate

Chromium Binary for AWS Lambda

Install

$ npm i chrome-aws-lambda

This will ship with appropriate binary for the latest stable release of puppeteer (usually updated within a day or two).

If you wish to install an older version of Chromium, take a look at Versioning.

API

PropertyReturnsDescription
args{!Array<string>}Provides a list of recommended additional Chromium flags.
defaultViewport{!Object}Returns more sensible default viewport settings.
executablePath{?Promise<string>}Returns the path where the Chromium binary was extracted.
headless{!boolean}Returns true if we are running on AWS Lambda.
puppeteer{!Object}Overloads puppeteer and returns the resolved package.

Usage

The nodejs8.10 AWS Lambda runtime is required for this package to work properly.

const chromium = require('chrome-aws-lambda');
const puppeteer = require('puppeteer-core');

exports.handler = async (event, context) => {
  let result = null;
  let browser = null;

  try {
    browser = await puppeteer.launch({
      args: chromium.args,
      executablePath: await chromium.executablePath,
      headless: chromium.headless,
    });

    let page = await browser.newPage();

    await page.goto(event.url || 'https://example.com');

    result = await page.title();
  } catch (error) {
    return context.fail(error);
  } finally {
    if (browser !== null) {
      await browser.close();
    }
  }

  return context.succeed(result);
};

You should allocate at least 512 MB of RAM to your Lambda, 1536 MB is recommended.

Overloading

Since version 1.7.0, it's also possible to overload puppeteer / puppeteer-core API with useful methods:

  • Frame
    • count(selector)
    • exists(selector)
    • fill(form, data, heuristic = 'name')
    • number(selector, decimal = null, index = null, property = 'textContent')
    • selectByLabel(selector, ...values)
    • string(selector, property = 'textContent')
    • waitUntilVisible(selector, timeout = null)
    • waitWhileVisible(selector, timeout = null)
  • Page
    • clickAndWaitForNavigation(selector, options = null)
    • count(selector)
    • exists(selector)
    • fill(form, data, heuristic = 'name')
    • go(url, options = null)
    • number(selector, decimal = null, index = null, property = 'textContent')
    • selectByLabel(selector, ...values)
    • string(selector, property = 'textContent')
    • waitUntilVisible(selector, timeout = null)
    • waitWhileVisible(selector, timeout = null)

Besides the public API, the following browser-context methods will also become available:

  • σ.$(selector, context = document)
  • σ.$$(selector, index = null, context = document)
  • σ.$x(expression, index = null, context = document)
  • σ.$number(data, decimal = null, index = null, property = 'textContent')
  • σ.$string(data, property = 'textContent')
  • σ.$regexp(data, pattern, index = null, property = 'textContent')

To enable overloading, simply call the puppeteer property exposed by this package.

Versioning

This package is versioned based on the underlying puppeteer version:

puppeteer Versionchrome-aws-lambda VersionChromium Revision
1.8.0npm i chrome-aws-lambda@1.8.0 --save-exact588429 (71.0.3542.0)
1.7.0npm i chrome-aws-lambda@1.7.0 --save-exact579032 (70.0.3508.0)
1.6.2npm i chrome-aws-lambda@1.6.2 --save-exact575458 (69.0.3494.0)
1.5.0npm i chrome-aws-lambda@1.5.0 --save-exact564778 (69.0.3452.0)
1.4.0npm i chrome-aws-lambda@1.4.0 --save-exact555668 (68.0.3419.0)
1.3.0npm i chrome-aws-lambda@1.3.0 --save-exact549031 (67.0.3391.0)
1.2.0npm i chrome-aws-lambda@1.2.0 --save-exact543305 (67.0.3372.0)
1.1.0npm i chrome-aws-lambda@1.1.0 --save-exact536395 (66.0.3347.0)
1.0.0npm i chrome-aws-lambda@1.0.0 --save-exact526987 (65.0.3312.0)
0.13.0npm i chrome-aws-lambda@0.13.0 --save-exact515411 (64.0.3264.0)

Compiling

To compile your own version of Chromium check the Ansible playbook instructions.

Compression

The Chromium binary is compressed using the Brotli algorithm.

This allows us to get the best compression ratio and faster decompression times.

FileAlgorithmLevelBytesMiB%Inflation
chromium--136964856130.62--
chromium.gzGzip15166208749.2762.28%1.035s
chromium.gzGzip25043835248.1063.17%1.016s
chromium.gzGzip34942845947.1463.91%0.968s
chromium.gzGzip44787397845.6665.05%0.950s
chromium.gzGzip54692942244.7665.74%0.938s
chromium.gzGzip64652252944.3766.03%0.919s
chromium.gzGzip74640640644.2666.12%0.917s
chromium.gzGzip84629791744.1566.20%0.916s
chromium.gzGzip94627097244.1366.22%0.968s
chromium.gzZopfli104508916143.0067.08%0.919s
chromium.gzZopfli204508586843.0067.08%0.919s
chromium.gzZopfli304508500343.0067.08%0.925s
chromium.gzZopfli404508432843.0067.08%0.921s
chromium.gzZopfli504508409843.0067.08%0.935s
chromium.brBrotli05540121152.8359.55%0.778s
chromium.brBrotli15442952351.9160.26%0.757s
chromium.brBrotli24643612644.2866.10%0.659s
chromium.brBrotli34612203343.9966.33%0.616s
chromium.brBrotli44505023942.9667.11%0.692s
chromium.brBrotli54081351038.9270.20%0.598s
chromium.brBrotli64011695138.2670.71%0.601s
chromium.brBrotli73930228137.4871.30%0.615s
chromium.brBrotli83903830337.2371.50%0.668s
chromium.brBrotli93885399437.0571.63%0.673s
chromium.brBrotli103609008734.4273.65%0.765s
chromium.brBrotli113482040833.2174.58%0.712s

For this reason, a stripped-down version of iltorb is bundled as a dependency.

License

MIT

Keywords

FAQs

Package last updated on 11 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc