Reading a file from Expo's cache as base64, writing to firebase storage (Cloud Storage for Firebase)

北城余情 提交于 2020-01-22 02:26:13

问题


After using expo's ImagePicker and saving the image in the local cache, I am trying to save the image to firebase storage (or its new name, Cloud Storage for Firebase).

The relevant code is:

base64String =
  FileSystem.readAsStringAsync(photoUri,
  { encoding: FileSystem.EncodingTypes.Base64 });

and then

ref.putString(base64String,'base64',
  { contentType: 'image/jpeg' })

However, something is wrong with the image that I save to firestore, and I cannot view it (either directly from the firestore console or my code).

Am I doing anything wrong?

来源:https://stackoverflow.com/questions/53294492/reading-a-file-from-expos-cache-as-base64-writing-to-firebase-storage-cloud-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!