i basically need to save a blob on a mongo database, on my back end i use node express / moongose as orm , im sending a audio blob to my back end i dont know what would be the best aproach to save this audio on my db, retrive later on my front end and play, i heard about grindfs, but that should only be used for files bigger than 16 mb and this blob come from a 00:30 sec audio record.
thanks in advance guys... sorry for my english in advance...
the schema where i need to save the blob on my back end
blob coming from my back end
i tried to generate a base64 string of that blob, but this return a huge string, and i dont think that is very performative just trhow that string on my database
i just need to save the audio as a blob on my db, retrieve on my front end and play the same audio
Related
I am working on a project in which I need to upload some data such as an image, text file etc to a Ethereum Blockchain and to retrieve it later using some kind of a block hash which I want to store in a Database.
Can you please suggest me how can I do this ?
you can use base64 string format for saving in blockchain, just google "encode base64 image javascript" ;)
I know that blob is a data type for binary data as integer is a datatype for int. As they say, It's used to store files directly in database (we move our audio file into blob, and save that blob in database).
Question 1) why to store blob for audio if I can just put the audio in storage for example path /var/www/audio.mp3 and in database I store path_name /var/www/audio.mp3?
Question 2) which is better ? how netflix stores movies? just blobs or what?
Question 3) Curious if there're any cons or prons if you could just give me ideas so that I know when to use them .
Putting the blob in the database, rather than a file, allows you to grow to multiple servers with load balancing. If you put the data in files, you would have to replicate the files between the server. Most databases have built-in replication features, this isn't as easy for regular files.
Better to use external storage/cdn for serving such kind of large content.
How Netflix and our works? They upload content on external bucket i. e. S3 and write file name in db for identification. According to user file access frequency that file cache on CDN/edge location. User will get awesome experience while content server from their nearest edge location
With blob you can store all kinds of stuff.
Do you communicate with an API via SOAP or JSON and want to store it in the database? Use a blob. Want to log what a user filled into a form when it threw an exception? Store the entire post as a blob. You can save everything as is. It's handy for logging if you have different data formats. I know an API which expects some data via SOAP and some as JSON. To log the communication I use blob because the response may be in XML, JSON, a number (http code 203 for empty but accepted) or an exception as array.
What I gonna do is to capture a user video from webcamera in HTML than send this video to python which is to do the emotion analyzing.
I have get the video in by others work (RTC) which is a blob in javascript. My problem is how could I receive the video properly?
I try to use websocket to send the blob and the problem is how could i parse the received data back to a video in python?
I try to find some stuff but nothing. Maybe I choose the wrong idea. It would be great thanks if anyone give some tips.
I'm trying to implement an HTML controller in my webapp that will upload files from the client to my azure blob storage.
I know how to do it in the server side with C# but this solution isn't right for me because i'm dealing with a large volume files(that the client uploads), so I don't want to upload them to my server side, I want that the client will upload them straight to the blob storage.
but here is where I'm lost, maybe you could help me.
Objective: I need to grant SAS for that user.
Solution: I call(using AJAX) to a server side method that generate the string (string - URL + SAS token)
Now all is left to do is split the files to chunks and upload them giving the URL with the token that I generate on the server side.
I read a lot of article about it but every article says different things, half of them was in the period that azure was not supporting CORS, so a huge amount of them out of date.
How can I do the last two things in the right way :
1.Chunk the file.
2.Upload the file.
One last thing i read in some article that i need to split the file to chunks and then upload all the chunks and then to commit or something all the chunks so its become one file in the storage.(maybe i got it in the worng way)
anyway if somebody could help me with guidelines or anything that will help me overcome this two last jobs needed to be done
*Update:
The errors I get(1.OPTION 2. headers):
Open the image in a new tab to see it properly
*Update 2:
This is how i set the CORS:
I'm storing several mp3 files in MS SQL Server'08 as BLOB objects (I use filestream). There's a WCF service which can send one of this objects to html client.
Preliminarily I convert BLOB to byte[] using ToArray().
How to convert incoming byte[] array to audio(mp3) and play it?This's only javascript/html on client.
I use SoundManager2 http://www.schillmania.com/projects/soundmanager2/
to play audio.
Thanks!