Fernando Aureliano
Fernando Aureliano

Reputation: 914

NodeJS: using chrome-remote-interface instead puppeteer

I have a project which uses puppeteer to print PDFs, the problem is the download of chromium is too large to work with servers, so I want to migrate it to chrome-remote-interface instead. There is a better way to do that? I will change too much my code?

Upvotes: 2

Views: 1105

Answers (1)

Md. Abu Taher
Md. Abu Taher

Reputation: 18826

You don't even need to switch to such libraries for this problem. Puppeteer already has solution for that.

puppeteer-core

Puppeteer has puppeteer-core library which is without the chrome download and will work with remote interface.

The only difference between puppeteer-core and puppeteer atm is that puppeteer-core doesn't install chromium. So you can just swipe it.

The original difference is described here. The document for .connect is here.

Using the environment variable

You can use puppeteer as usual, except provide PUPPETEER_SKIP_CHROMIUM_DOWNLOAD environment variable to skip the download when doing npm install.

Upvotes: 2

Related Questions