Store audio file in database (pouchdb)

I work on expo to make an audio app and I try to read the audio file so that I can insert in the database (pouchdb) but when I read the files with FileSystem this me a string of UTF8 I decode it base64 with btoa (unescape (encodeURIComponent (my_string_from_file))); i tried too with new Blob , But I can not read them from the database . someone can help me pls ?

How about storing the file:// URI for the audio file in the database and just storing the audio file in Expo.FileSystem.documentDirectory?

2 Likes

but it will work if i want to play it form my web site?

Ok so here’s what your actual question is:

I recorded an audio file locally on my Expo app using Expo’s Audio.Recording API. It saved to a local file URI on my phone. I want to upload this to my server and store it in my server’s database in a way that I can play later from my website. How would I go about this?

I had to clarify because a possible reading is that you want to store this in a local database like SQLite on your phone, or any number of other things.

image-upload-example/frontend/main.js at ba7f5cfce617d5d6c59e636199effaf099aac861 · expo/image-upload-example · GitHub is an example of how to upload things as FormData, you just have { uri: localUri } where localUri is the file:// URI to your file in Expo’s FileSystem as an element in the FormData.

1 Like

yes, that’s exactly what I meant, you already answered me on slack i will try it, thank you for helping me.

Awesome!!! :smiley:

Same problem i have,when i am moving my file to folder,am getting error like file con’t movable.