简体   繁体   English

如何从 React Native expo 应用程序中的 fetch 接收到的数据中获取 base64 字符串?

[英]How to get base64 string from a data received from fetch in React Native expo app?

I'm using fetch in React-Native expo app.我在 React-Native expo 应用程序中使用 fetch。

fetch(url).then( data=>data.blob()).then( data=>

And here where I got stuck.在这里我被卡住了。 How to get the Base64 data to use in the data: scheme in the Image component (using URL is not an option) ?如何获取 Base64 数据以在数据中使用:Image 组件中的方案(使用 URL 不是一个选项)? It looks like any js base64 converter requires strings, not binary data.看起来任何 js base64 转换器都需要字符串,而不是二进制数据。

Please advice.请指教。 Regards问候

let reader = new FileReader();
reader.readAsDataURL(blob);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM