Generic QR Code creation

This commit is contained in:
Omar Mihilmy 2019-01-13 18:59:45 +00:00
parent c076570d51
commit 0607f6d06e
3 changed files with 1124 additions and 720 deletions

1823
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,12 +22,14 @@
"dependencies": {
"bcrypt": "^3.0.2",
"express": "^4.16.4",
"fast-crc32c": "^1.0.4",
"firebase": "^5.7.0",
"firebase-admin": "^6.4.0",
"lodash": "^4.17.11",
"lokijs": "^1.5.5",
"oauth-1.0a": "^2.2.5",
"phone": "^2.3.0",
"qrcode": "^1.3.2",
"request": "^2.88.0",
"twilio": "^3.25.0",
"uuid": "^3.3.2"

19
src/ups/utils/qrcode.js Normal file
View File

@ -0,0 +1,19 @@
const QRCode = require('qrcode');
const options = {
margin: 1,
width: 300
};
/**
* Encodes a pieace of text returning a promise containg base64 bytes of a png image
* @param {String} text Text to encode
* @returns {Promise<String>}
*/
function createQRCode(text) {
return QRCode.toDataURL(text, options).then(data => data.slice(22));
}
module.exports = {
createQRCode
};