How to convert the picture in the temporary path of wx.chooseImage into binary content in WeChat Mini Programs

how to convert images in the temporary path of wx.chooseImage into binary content in WeChat Mini Programs

because you want to adjust Tencent Cloud"s universal printed OCR character recognition interface, there is such a demand

The address returned after the success of

wx.chooseImage is as follows: "https://img.codeshelper.com/upload/img/2021/06/22/xldyv5era3e18278.jpg"

"

how to convert to binary?
Please answer Daniel, thank you!


Tencent Cloud's general printed OCR character recognition interface supports Base64 format
can introduce a third-party js Base64 coding library to complete coding
dankogai/js-base64


wx.getFileSystemManager (). ReadFile ({
filePath: imgPath,
encoding: 'base64',
})

Menu