Handling audio files stored on MongoDB Cloud

I am working on a small web app in javascript (node.js), using MongoDB Cloud.
The app handles audio files, below is an example of such a file stored in the DB.fs.files collection.

_id
:6718f0f9a4752b0014312e9a
length
:68263
chunkSize
:261120
uploadDate
:2021-05-10T08:37:11.880+00:00
filename
:"bd5e3643e5ebc6aa15f1b357e1a331cc_Voice.bin"
md5
:"147210ccf9a5d0ecbb4d0356af4d71d2"

I want to give to the user the possibility to click a link (or some button) to play the sound file, as well as the possibility to download it. What is the best and easiest way to do that?

At this point I only display the file name:
bd5e3643e5ebc6aa15f1b357e1a331cc_Voice.bin

But I am not sure what link I should create with it.

1 Like