It is already possible to render to a canvas then call toDataURL, but browsers do not typically optimise these exports very well, leading to large file sizes (for QR codes we only need 2-colour images, but browsers export 32-bit images).
Browsers now support deflate via CompressionStream, so it is practical to support generating PNG files / data URIs on the client-side.
This API is asynchronous, so it cannot be a drop-in replacement for the existing PNG export options available in NodeJS (which provide synchronous APIs)
It is already possible to render to a canvas then call
toDataURL, but browsers do not typically optimise these exports very well, leading to large file sizes (for QR codes we only need 2-colour images, but browsers export 32-bit images).Browsers now support deflate via CompressionStream, so it is practical to support generating PNG files / data URIs on the client-side.
This API is asynchronous, so it cannot be a drop-in replacement for the existing PNG export options available in NodeJS (which provide synchronous APIs)