alpha0010/react-native-file-access

Write Blob, instead of just string

Opened this issue · 2 comments

Feature
I am creating an XLSX file and I would like to save it in the file system.

But right now the only way is to convert it to string, which might not work since it's a compressed files.

Motivation
It can be used to save images and other media files too.

I tried the base64 method but it says bad base64

This is what my string looks like:

data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,UEsDBBQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Good idea. Not sure when I will have time to implement though, as I am quite busy currently (pull requests always welcome).

Until then, you can use a workaround to get it working in your app. Trouble is that string is a data URL, not pure base64 data. Here are a variety of ways to convert the blob so it will work with base64 methods of this library.