Store audio file in database (pouchdb)

#1

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 ?

0 Likes

#2

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

#5

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

0 Likes

#6

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.

https://github.com/expo/image-upload-example/blob/ba7f5cfce617d5d6c59e636199effaf099aac861/frontend/main.js#L155-L187 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

#7

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

0 Likes

#8

Awesome!!! :smiley:

0 Likes

#9

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

0 Likes