ushelp / EasyQRCodeJS-NodeJS

EasyQRCodeJS-NodeJS is a NodeJS server side javascript QRCode image(PNG/JPEG/SVG/Base64 data url) generator. Support setting Dot style, Logo, Background image, Colorful, Title and more. Support binary(hex) data mode.
https://easyproject.cn/easyqrcode
MIT License
103 stars 53 forks source link

add toStream() to get a stream from canvas back #23

Closed sir-bobselot closed 3 years ago

sir-bobselot commented 3 years ago

Added a toStream() function to be able to work with the canvas stream like this:

const qrCode = new QRCode(options);

const out = fs.createWriteStream(`${__dirname}/streamt.png`);
const stream = await qrCode.toStream();
stream.pipe(out);
out.on('finish', () => console.log('Finsihed'));
ushelp commented 3 years ago

@sir-bobselot Thanks for your pull request. but we found a bug in your code. So we based your code released a new version 4.5.0 to support this function.