Best Practice for Serving Assets URLs with File Extensions
Hello Convex community!
I'm currently working on a project where I need to serve various assets such as images, textures, and GLB files from URLs that have proper extensions like .png, .jpg, and .glb. However, I'm struggling to find the best way to achieve this within the Convex framework.
Could anyone provide guidance or best practices on how to properly serve these types of assets with the specified extensions? Any tips on handling URLs with these extensions would be greatly appreciated!
Thank you!
4 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
Convex has file storage that should handle your file types fine: https://docs.convex.dev/file-storage
File Storage | Convex Developer Hub
Store and serve files of any type.
Thanks for your reply, we are currently using convex storage. But the URLs are served without an extension out of the box.
The frontend framework we are using needs URLs that are served with extensions, such as
.glb
extension. Example: /asset/${storageId}.glb
, /asset/${storageId}.png
Is there a best practice for appending extensions to urls to be served?Ah hmm can your framework accept the file type any other way? You can access the type via metadata if that’s an option. If not I can look for another approach here
Accessing File Metadata | Convex Developer Hub
Every stored file is reflected as a document in the "_storage" system table.