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

Is there a downloader? #998

Open
ml2s opened this issue Sep 30, 2024 · 4 comments
Open

Is there a downloader? #998

ml2s opened this issue Sep 30, 2024 · 4 comments

Comments

@ml2s
Copy link

ml2s commented Sep 30, 2024

Is your feature request related to a problem? Please describe.
I have a need to export output table/dataframe to a spreadsheet for a user to download

Describe the solution you'd like
Just like the "Uploader" component, when user clicks, a file explorer pops up to choose a folder/file to save.

Describe alternatives you've considered
Not sure if the "Link" component would work as a downloader?

Additional context
No.

@richard-to
Copy link
Collaborator

Right now there is no clean way to do this. But it is not impossible to do I think.

Easiest option may be to use a data url with the me.html component (See #453)

Drawback here is that it's not going to be great if the file is huge. Also you have less control over styling with me.html, though you can try embedding your own stylesheet.


There is also another way, which is to mount a Fast API server with Mesop. You can then use expose a download link via Fast API. This will require saving the data you want the user to download on the file system / database / cloud storage. Then having your Fast API endpoint retrieve that file from the file system / database / cloud storage endpoint.

This way is better for larger data files. And also you have more control over the look.

It's not super hard, but also not trivial.

@ml2s
Copy link
Author

ml2s commented Oct 1, 2024

Thank you so much for the reply! I'll try the easy option first, my output file is small.

@loretoparisi
Copy link

👍🏾

@raphsaeed
Copy link

Thanks, download file would be nice feature, for now I am just using download link option.
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants