标签:div require console map pat erro function highlight throw
const {readFile, readFileSync} = require(‘fs‘); const decodeImage = require(‘jimp‘).read; const qrcodeReader = require(‘qrcode-reader‘); const path = require("path"); var p = path.resolve(__dirname,"data/qrcode2.jpg"); readFile(p,function(err,fileBuffer){ if(err){ throw new Error(err); return ; } decodeImage(fileBuffer,function(err,image){ if(err){ throw new Error(err); return ; } let decodeQR = new qrcodeReader(); decodeQR.callback = function(errorWhenDecodeQR, result) { if (errorWhenDecodeQR) { throw new Error(errorWhenDecodeQR) return; } if (!result){ console.log("gone with wind"); }else{ console.log(result.result); //结果 } }; decodeQR.decode(image.bitmap); }); })
标签:div require console map pat erro function highlight throw
原文地址:https://www.cnblogs.com/muamaker/p/10094905.html