pingdotgg / uploadthing

File uploads for modern web devs
https://uploadthing.com
MIT License
3.87k stars 282 forks source link

feat: Avoid Duplicates #772

Open bfourgeaud opened 4 months ago

bfourgeaud commented 4 months ago

Describe the feature you'd like to request

It would be great if it was possible to avoid duplicate files. If I upload an image that already exists in the database (check hash for example, or set a custom_id), uploadthing would return the data of that already existing file instead of uploading it again.

Describe the solution you'd like to see

Maybe an option in the FileRouterInputConfigand add a property overwrite: boolean
Or setting a custom metadata on each file with a custom hash that we would calculate on everyfile before uploading. And uploadthing would match existing files based on that metadata.hash

Additional information

No response

๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Contributing

juliusmarminge commented 4 months ago

This is planned, but not sure how high up on the priority list.