Running a React Native app, and trying to solve this issue. The b64 is sent to a an API and stored in db as blob, I know it s not best practice, but this isn t an app of any scale, just a simple student project.
const file = await DocumentPicker.getDocumentAsync({
type: "image/*",
copyToCacheDirectory: true,
});
用于流动:
const uri = await fetch(file.uri);
const blob = await uri.blob();
const res = await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onloadend = () => resolve(reader.result);
reader.onerror = (error) => reject(error);
}).then((result) => {
return result;
});
base64 = res as string;
仅供网站使用。 从那时起,就座。
然而,在这两种情况下,b64 p不正确,但对 j和 j来说是正确的。 这个问题是众所周知的,还是我刚刚失去了一些特殊警卫,我需要拿起甲型六氯环己烷的价值吗?
FYI 采用权宜法
Edit, example of the b64 which produced for png:
https://controlc.com/f9073658 -b64 too long for SO