How to download files from my instance

Apologies in advance if this question seems stupid to someone, I am a beginner. Can someone please let me know how do I download a file from my instance? I need to download an sqlite file which is on the disk of my instance. Any sh command?

Thank you in advance

Hi @Harsimran_Singh,

Thank you for writing on community.

Unfortunately, it is not possible out of the box. You can generally set up AWS S3 or a similar cloud storage service.
If you need to download a file only once, you could post the file to another location using curl, remote ssh or expose the file in the server.

How to Download Files from Your Koyeb Instance (Simple & Effective Method)

If you’re running a Flask or Python app on a service like Koyeb and can’t modify the running app to expose a file download route, here’s a simple workaround I used to zip my current directory and upload it to Gofile.io or File .io for downloading.


:desktop_computer: Step 0: Navigate to Your Instance Console

Log in to Koyeb Dashboard →
Go to your running app → Click (console) to open a live terminal session inside your instance.

This is where you’ll run the following commands.


Step 1: Create zipcwd.py to Zip Your Files

Use this echo command to quickly create the Python script:

bash

CopyEdit

echo "import os, zipfile

def zip_current_dir(output='cwd.zip'):
    base = os.getcwd()
    files = [f for f in os.listdir(base) if os.path.isfile(f)]

    print(f'Zipping {len(files)} files from current directory...')
    with zipfile.ZipFile(output, 'w', zipfile.ZIP_DEFLATED) as zipf:
        for i, f in enumerate(files, 1):
            zipf.write(f)
            print(f'[{i}/{len(files)}] Zipped: {f}')

if __name__ == '__main__':
    zip_current_dir()" > zipcwd.py

Run the script:

bash

CopyEdit

python zipcwd.py

This will generate a cwd.zip file with all files in your current directory.


Step 2: Upload the Zip File

Option A: Using GoFile.io

bash

CopyEdit

curl -F "file=@cwd.zip" https://store1.gofile.io/uploadFile

Example response:

json

CopyEdit

{
  "data": {
    "downloadPage": "https://gofile.io/d/B876Al",
    ...
  },
  "status": "ok"
}

:link: Copy the downloadPage link and open it in your browser to download the file from anywhere.

You can use the koyeb CLI with koyeb instances cp !

You’ll find more details in our docs: Koyeb CLI Reference | Koyeb

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.