Search code examples
node.jsexpressamazon-s3google-cloud-firestoreazure-storage

Is saving uploaded filles in folder in the server a Good practice?


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


Solution

  • 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.