How to get file from a component or download a file in stream base64

So the problem I’m having is that I want to download a file (pictures, PDF, etc) for the sharing, the problem is that I get a stream in base64, I can show them like this:

uri: data:image/${fileSelected.extension.toLowerCase()};base64,${ },

or for PDF

style={{ width: “100%”, height: “100%” }}
base64: “data:application/pdf;base64,” +,

but when I want to download those, I don’t know how to do it

if i want to get to the pdf like this

if (!(await Sharing.isAvailableAsync())) {
alert(Uh oh, sharing isn't available on your platform);
let filetoSave = “data:application/pdf;base64,” +
await Sharing.shareAsync(filetoSave)

I get this error
Unhandled promise rejection: Error: You don’t have access to provided file.

1 Like