Download zip file

Hi @diegovct and @BeyondMyself :wave:

With Streamlit version 0.88.0, you can use st.download_button :slightly_smiling_face:

If your zip file, say myfile.zip, is in the same location as your app:

import streamlit as st

with open("myfile.zip", "rb") as fp:
    btn = st.download_button(
        label="Download ZIP",
        data=fp,
        file_name="myfile.zip",
        mime="application/zip"
    )

If it’s in a folder, say dir/myfile.zip, you can download from a file pointer:

import streamlit as st

with open("dir/myfile.zip", "rb") as fp:
    btn = st.download_button(
        label="Download ZIP",
        data=fp,
        file_name="myfile.zip",
        mime="application/zip"
    )

Happy Streamlit’ing! :balloon:
Snehan

6 Likes