Search code examples
pythonrestflaskubuntu-18.04flask-restful

Is there a way to send a zip file from server via api using flask-python?


I need to develop an api in which zip file is stored in server and gets synced at client side when requested by it. Is there a way to do that?


Solution

  • To return a file flask provides the send_file() function.

    return send_file('<FILE_PATH>', as_attachment=True, attachment_filename='<FILE_ATTACHMENT_NAME>')
    

    Here the link to the documentation