Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: metadata field of file size #927

Open
1 task done
didinewlander opened this issue Sep 2, 2024 · 1 comment
Open
1 task done

feat: metadata field of file size #927

didinewlander opened this issue Sep 2, 2024 · 1 comment
Labels
✨ enhancement suggestion or feature request to improve uploadthing planned We would like this to happen

Comments

@didinewlander
Copy link

Describe the feature you'd like to request

when fetching a list of files I get only the URL, so the user can't actually show them what is the file size.
This can cause some UX uninformative, especially for users with limited internet access asking to review the size of the file before triggering a preview or download of the file.
Another use case is for server processing, the file size can affect the kind of process to handle that file

Describe the solution you'd like to see

import { utapi } from "~/server/uploadthing.ts";
 
const files = await utapi.listFiles();
 
console.log(files);
  [
 {
     id: "7099d109-39ec-43fe-a887-4a4fd87cad88 ,
     customId: null, 
     key: "2e0fdb64-9957-4262-8e45-f372ba903ac8_image.jpg",
     size: 10302 KB // or a MB format
     name: "image.jpg",
     status: "uploaded",
   }
 ]

Use Case - Dashboards

Well, while creating this issue I went back and forth across the API and the dashboard inorder to find where the size field could come in use, and it appears only in the dashboard, where I could review the file list, but if I wish to provide my client a similar dashboard - the size would come in handy.

Use Case - Storage Limit

Just like UT itself, I don't want my client to upload files with no limit - I need to be able to provide him with context about the overall space his files take in the system

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!
@didinewlander didinewlander added the ✨ enhancement suggestion or feature request to improve uploadthing label Sep 2, 2024
@markflorkowski
Copy link
Collaborator

I'll bring this up with the team. Our design assumes you'd store the necessary data in your own database, which is typically faster than retrieving it via an API call—hence the minimal information returned by this API. That said, we've received similar requests for this functionality, so it's something we're considering.

cc @t3dotgg

@markflorkowski markflorkowski added the planned We would like this to happen label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement suggestion or feature request to improve uploadthing planned We would like this to happen
Projects
None yet
Development

No branches or pull requests

2 participants