Is saving uploaded filles in folder in the server a Good practice? - node.js

Hey guys I'm begginer and asking if i could save uploaded files in a folder in the server and then save a path in the database
Note that I'm building a short video sharing app

Here's what I can tell you from my personal experience + research.
You should definitely put videos in a server and store the URL in the DB.
Make sure you use a Compression Library inside your app to compress videos before uploading! Think of what's app and messenger, they compress before uploading.
When Retrieving Said videos, store them in the App Cache and try to clear the cache when the video is out of scope or not in use. An App like this requires multithreading for optimal performance. I know that there is a lot to take in but try to experiment, and you'll understand why these concepts are important.
For images, it may vary. I'm mentioning pictures because you may have thumbnails, etc. If they are small images and you're able to compress them you can store them as a Blob in your SQL DB however most people wouldn't recommend it.

Related

How do I store news articles with images inside in MongoDB?

This might seem like a simple question for you, but I have spent the whole day on the internet searching for a good answer. What I am creating is a news web app with ReactJS as front-end and NodeJS Express backend and MongoDB. I am stuck on how do I store the articles with images inside the articles if required (very important). One option is to store them as documents but then how do I update it whenever required? (Help out this silly beginner, please)
Assuming you have decided that it's the best thing to store images inside the database, I would base64 encode it and store it in the database, and when you retrieve it, decode and serve the image.
Without that assumption, though, putting images in the database makes your database grow larger, backups take longer, etc. And you get very few benefits - it's not like sorting or indexing pictures is a thing.

Anyone using the clouds to hold their RETS images.. Need more space any thoughts?

Is anyone using a cloud to provide access to their RETS MLS images so that the pubic can access at will w/o password? I currently have the images storing on my server for direct public access through my website, however need lots more space and just not sure about how to get the images to the web and make them available to view through my website. I download them each 15 min from the RETS server and store them on my server. So, what I need is the procedure to convert this storage to a cloud, knowing there may be some password requirements to access the cloud.
We are using Azure Storage (https://learn.microsoft.com/en-us/azure/storage/) to cache all of the images for one of our products. We sort of "lazy load" the images in there. If a request is made for an image, we pull it from our cloud storage (where the image is made public) and stream it from there much faster than over RETS media request. If we ever have to make an on demand request from a RETS server for the image we immediately cache it. We'll also pre-fetch images for slower MLS's. Images have been a severe performance impact on working with RETS systems for us.
This also lets us do some cool stuff like resizing the image on the fly pretty quickly too for our customers so they don't have to waste bandwidth downloading full size images if that's not what they want.
Here is a link to our open source SDK on how our customers end up using the image service.
https://github.com/timitek/getrets-php-sdk#imageurl
Amazon S3 Buckets is a better solution. We have around 18 TB of data in it. And also like you said " each image needs it own directory", we have millions of directories for 400+ MLSs.
Everything works fine and there is no delay as well. Its scalable too.
Note: We are getting binary raw data for MLS images and that we are directly writing to S3 and making the image urls.

Do I need azure media services for streaming a video to html5

I am currently planing the total cost of hosting my videos on azure. After studying the pricing I noted that the costs for storing the data is actually much lower than the price for converting them. Unfortunately I will have many videos, but they won't be watched a lot. Therefore the relative cost for converting them to different formats is too high for me.
Now my question, do I actually need to convert the videos to different formats or wouldn't it be possible to send the video directly from the storage to the browser?
To send video's from storage to browser you can use SAS urls as Zain mentioned. You need to ask yourself what devices,bitrates your solution is targeting: which browsers, web only or web + mobile.
Probably you want your users be able to start watching video before it has been fully downloaded on client(progressive download). Make sure that you encoded it into desired bitrate and moov atom in the video is placed at the beginning of file -https://support.jwplayer.com/customer/portal/questions/12945932-mp4-file-progressive-play.
Based on your original video format and answers to above questions you might need to re-encode your videos and upload re-encoded version to server.
Yes, it's possible to send them directly from storage to the browser, just like it's possible to send any file that you make publicly accessible.
If you're going to store your videos in blob storage, just make sure you either mark the container as public or you generate SAS urls for each video that make them publicly accessible.

Hosting Audio Files

I'm considering building a website that helps musicians collaborate remotely. To do this, they would need to share large (uncompressed) audio files.
For the solution I'm considering, I'd like to be able to perform the following functions:
upload/download uncompressed audio files
stream uploaded audio
My concern is the large bandwidth demand. Should I perform these actions on my own (hosted) server space, or is there a service with APIs I can use?
I've checked out Amazon's S3 which allows me to host files, however I can't find anything that suggests I can stream from their services. I'm not sure that S3 is right for what I'm trying to achieve.
Can someone provide some high-level architectural advice?
Thanks in advance.
What Paul mentioned in his comments is true... S3 is not designed to be a CDN.
However, if your audio files aren't intended to be used by over a thousand people at a time, you don't actually need a CDN. You can put them on S3 and stream directly from there (over HTTP) without difficulty. It sounds like you're going to have a bunch of tracks that will only be accessed by a handful of people. S3 is fine for this.
When it comes to publishing finished work that might be used by many, that would be a good time to use Cloudfront.

Advice on having videos on the device vs an alternative

I am working on an App that will have a bunch of pictures and videos the user will need to have. The app's mantra is having these videos and pictures available on demand and on the go. However, I am concerned about the app being too fat (big), in essence turning off some customers who prioritize size over substance. The preference has always been to have the customer be able to access these videos from anywhere regardless of 3g/wifi (i.e. local on the device). What are the really good options? Assuming I choose to elect to go the non-local route (i.e. using wifi/3g), what are my options there as well? Please advice. The size of the videos/pics could be up to 1.5GB.
The usual approach seems to be to download and store the videos on demand. A lot of the apps I've seen allow the user to manage the stored videos themselves so that they can remove videos if they aren't going to use them again.

Resources