How can I download a file from Heroku bash?

bash, heroku

Solution

Heroku dyno filesystems are ephemeral, non-persistant and not shared between dynos. So when you do `heroku run bash`, you actually get a new dyno with a fresh deployment of you app without any of the changes made to ephemeral filesystems in other dynos.

If you want to do something like this, you should probably either do it all in a `heroku run bash` session or all in a request to a web app running on Heroku that responds with the CSV file you want.

Problem

I ran a ruby script from Heroku bash that generates a CSV file on the server that I want to download. I tried moving it to the public folder to download, but that didn't work. I figured out that after every session in the Heroku bash console, the files delete. Is there a command to download directly from the Heroku bash console?

Original source