Skip to content

Download a file from S3 #6

Description

@cod3licious

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions