vendredi 3 avril 2020

Best way to architect a system to check if file already exists, and get it

I have a backend express server where I need it to check if an image is already stored on the server. The end user can upload any type of image to check if it's on the server.

The folder of images on the server is a folder, that contains lots of other folders and they contain images. They could have lots of images, perhaps 1000 in each folder so I don't want to get going through to manually check them.

I was thinking that I would initially get the hash of each image and store this along with the unique image name in a database table.

This way when the user uploads an image I can hash that image, then make a call to the database table and see if it exists there? Would there be an issue with speed here for a table that could contain 200k entries for example? If it was mysql what would be the best way to see if it contains the hash and get back the location?

Does this seem like the right approach?

Thanks

Aucun commentaire:

Enregistrer un commentaire