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

Download a file from S3 #6

Open
cod3licious opened this issue May 4, 2023 · 0 comments
Open

Download a file from S3 #6

cod3licious opened this issue May 4, 2023 · 0 comments

Comments

@cod3licious
Copy link

cod3licious commented May 4, 2023

I'm trying to download a PDF file from an S3 bucket. My best guess for how to do that was the following syntax:

import streamlit as st
from st_files_connection import FilesConnection

conn = st.experimental_connection("s3", type=FilesConnection)
with conn.open(
     "my-s3-bucket/path/to/file.pdf",
      mode="rb",
) as file:
      st.download_button(
          label="📥 Download (PDF)",
          data=file,
          file_name="my_file.pdf",
          mime="application/pdf",
          key="download-pdf",
      )

But I'm getting a RuntimeError: Invalid binary data format: <class 's3fs.core.S3File'>

Anything I'm doing wrong or is this functionality just not supported yet?

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

1 participant