第三方API返回base64编码的"二维码图像"
- CamerRoll-不支持将base64图像保存到相册
- react 本机获取Blob-
- react 本机fs-
- 很少有npm模块具有非常小的Github star(<;10)
React Native Fetch Blob维护人员失踪,因此没有人回答Github问题,
import fetch_blob from 'react-native-fetch-blob';
// json.qr variable are return from API
const fs = fetch_blob.fs
const base64 = fetch_blob.base64
const dirs = fetch_blob.fs.dirs
const file_path = dirs.DCIMDir + "/some.jpg"
const base64_img = base64.encode(json.qr)
fs.createFile(file_path, base64_img, 'base64')
.then((rep) => {
alert(JSON.stringify(rep));
})
.catch((error) => {
alert(JSON.stringify(error));
});
Anyone deal with this problem before?
How to save a base64 encode Image string to User album? (as a jpg or png file)
因为我需要一个没有CORS头的API,
我必须在我的Android手机上运行它才能正常工作
我计划使用剪贴板保存base64字符串,