etienne-martin / svg-to-img

A node.js library to convert SVGs to images built with Puppeteer.
MIT License
56 stars 22 forks source link

Support Browserless/Puppeteer browserWSEndpoint #9

Open madflow opened 5 years ago

madflow commented 5 years ago

Feature Request: Support connecting to a browserWSEndpoint. For example https://www.browserless.io/#integrations

const browser = await puppeteer.connect({
  browserWSEndpoint: 'wss://chrome.browserless.io'
});
etienne-martin commented 5 years ago

Good idea, could be useful for some people.

We could add a new connect method to connect to a new browser instance:

const convert = await svgToImg.connect({ endpoint: "wss://chrome.browserless.io" });

And then we would be able to use the normal API like so:

const image = await convert.from("<svg xmlns='http://www.w3.org/2000/svg'/>").toPng();

What do you think?

madflow commented 5 years ago

+1 for using the same API like before! Looks good to me :D

qqilihq commented 4 years ago

Hey there, we needed this as well and I'm currently testing a fork locally where I implemented this. Would you be interested in a PR once I've verified that it works?

etienne-martin commented 4 years ago

@qqilihq Yeah absolutely