screenshot-stream icon indicating copy to clipboard operation
screenshot-stream copied to clipboard

Headless Chrome

Open kevva opened this issue 8 years ago • 11 comments

Just need to create a bin-wrapper for it. Also, not sure if a streaming interface is available using https://github.com/cyrus-and/chrome-remote-interface. Worst case scenario is that we skip the streams altogether and just return a Promise or if we want to keep them, possibly just emit a data event with the buffer.

kevva avatar May 19 '17 09:05 kevva

The only reason we're using streams today is to improve performance, as we have to decode a huge Base64 string. If using a Promise is possible, I would much prefer that.

sindresorhus avatar May 19 '17 09:05 sindresorhus

Just need to create a bin-wrapper for it

I tried doing that two weeks ago but gave up. I couldn't find a version of Chrome that's just one binary that we can ship. Instead I tried doing it with the full blown Chrome from my computer which is like 160 MB or something. So if you guys can point me in the right direction, happy to create the wrapper.

SamVerschueren avatar May 19 '17 09:05 SamVerschueren

Also, is this really something we want to maintain? For reference: https://github.com/Medium/phantomjs/issues?utf8=%E2%9C%93&q= (Note the issue count)

sindresorhus avatar May 19 '17 09:05 sindresorhus

I was hoping I could just ignore Chrome Headless until someone did a bin wrapper, so I don't have to maintain it.

sindresorhus avatar May 19 '17 09:05 sindresorhus

I was hoping I could just ignore Chrome Headless until someone did a bin wrapper, so I don't have to maintain it.

I'm afraid that if no one of us does it, nobody will do it :p. Maintaining a bin-wrapper doesn't feel as complex as maintaining PhantomJS, or am I missing something? It's just a binary, right?

SamVerschueren avatar May 19 '17 09:05 SamVerschueren

Well, I had a look at it yesterday and it doesn't seem too complex tbh. I'd just get the latest revision from here https://chromium.woolyss.com/#api and then fetch the binary. There is some logic in here that we could make us of https://github.com/scheib/chromium-latest-linux/blob/master/update.sh.

Note that I haven't actually tried it out so the files from https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html might not work out of the box.

kevva avatar May 19 '17 09:05 kevva

The only reason we're using streams today is to improve performance, as we have to decode a huge Base64 string. If using a Promise is possible, I would much prefer that.

It still returns a Base64 string https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot.

kevva avatar May 19 '17 09:05 kevva

puppeteer might be worth checking out.

silverwind avatar Aug 16 '17 16:08 silverwind

Only works on Node 7.10+ for now though. But looks really nice.

SamVerschueren avatar Aug 18 '17 11:08 SamVerschueren

Yeah. It has no streaming API that I see, but we should evaluate if we can require Node.js 8, and possibly rename this package or create a new one with a more fitting name.

silverwind avatar Aug 18 '17 12:08 silverwind

@SamVerschueren the readme for puppeteer now reads:

Puppeteer requires at least Node v6.4.0,

What are the chances of getting this thing rolling again? Not sure that I would be successful at a PR but I might be able to take a stab.

c0bra avatar Mar 28 '18 18:03 c0bra