Skip to content

Instantly share code, notes, and snippets.

@cfsghost
Last active November 10, 2015 11:06
Show Gist options
  • Save cfsghost/b4d9286f9d89c0c9cb07 to your computer and use it in GitHub Desktop.
Save cfsghost/b4d9286f9d89c0c9cb07 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var qr = require('qr-image');
var co = require('co');
co(function *() {
for (var index = 1; index <= 100; index++) {
yield function() {
return function(done) {
var qr_img = qr.image(index, { type: 'png' });
var output = fs.createWriteStream('qrcode-' index '.png');
output.on('finish', function() {
done();
});
qr_img.pipe(output);
};
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment