mirror of
https://bitbucket.org/tagfer_team/tagfer-server.git
synced 2025-12-25 03:37:38 +00:00
Generic QR Code creation
This commit is contained in:
parent
c076570d51
commit
0607f6d06e
1823
package-lock.json
generated
1823
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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
19
src/ups/utils/qrcode.js
Normal 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
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user