Hiya friends :wave: I need some help with somethi...
# orm-help
k
Hiya friends 👋 I need some help with something. I'm using the Browser MediaRecorder API to record the user's audio. I'm encoding it to base64 so I can stick it in an
<audio />
src. I'm not sure whether there's another way to do that without creating an actual file. The files are about 3 minutes long or so and I'll probably not store more than 100-200 at any given time, and they won't be written/read very often. Anyway, I need to persist this to my Postgres db. I understand that base64 is a pretty poor way to store this data because it can be rather large. People have suggested I use a binary type and store it like that. My question is, how do I serialize a
base64
string as binary to store it in the db, and then deserialize it when it needs to be read. Second related question, does anyone know whether there's another way I can do this to avoid base64 while still allowing me to use what's been recorded directly in an
<audio />
Note a hard requirement is to not actually create files. That's just not going to happen here. Hopefully that makes sense. Thanks for the help!
👀 1
d
I was doing something similar, but with PDF files, I used Buffers to store it and then would convert it to base64 when I needed to read it