Open mykhalov opened 5 years ago
i would love to add this. would you like to make a pr?
Yes, I'll take it.
@growtofill Any update on it?
this is slightly more complicated because it requires refactoring of how renderers are picked in https://github.com/soldair/node-qrcode/blob/master/lib/server.js#L67 and https://github.com/soldair/node-qrcode/blob/master/lib/browser.js
Then a sync method would have to be added to supported renderers like https://github.com/soldair/node-qrcode/blob/master/lib/renderer/png.js
this is mostly unwrapping things with unnecessary callbacks.
the only renderer that needed to have an async version was toFile which isn't applicable to the browser anyway.
Rendering to canvas and exporting the data URL are both sync operations, it would be great to have a sync rendering function exported as well.
Currently, it can be achieved as follows: