Question

how to download file from DigitalOcean App platform?

I exported data from my strapi app hosted on DigitalOcean App platform to a .tar. how do I download it to my local system?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
March 7, 2024

Hey!

As the DigitalOcean App Platform does not offer SSH access, you can use alternative methods such as using the Strapi admin panel, creating a temporary download link, or using an API endpoint.

  1. Strapi Admin Panel (if your file is accessible there):

    • If the exported .tar file is accessible via the Strapi admin panel, you can simply log in to the admin panel and download the file from there. This would be the most straightforward approach if the file is visible within the UI.
  2. Creating a Temporary Download Link:

    • Modify your Strapi application to include a route that serves this .tar file. For example, you can create a public endpoint in Strapi that, when accessed, triggers a download of the .tar file.
    • Deploy these changes to your app on the DigitalOcean App Platform.
    • Once deployed, you can access this new endpoint from your browser or a tool like curl to download the .tar file.
  3. Using an API Endpoint:

    • If your Strapi app has a custom API endpoint or if you can create one, you can set up an endpoint to serve the .tar file. This endpoint could authenticate the user and then serve the .tar file as a response to a GET request.
    • After setting up and deploying the endpoint, you can use curl or any HTTP client to make a request to this endpoint and download the file.

For steps 2 and 3, here’s a basic example of how you might set up a route in Strapi to serve a static file (assuming you’re using Strapi v4):

// In your Strapi controller or a custom route handler
module.exports = {
  async download(ctx) {
    const file = 'path/to/your/file.tar'; // Path to your .tar file
    ctx.body = fs.createReadStream(file);
    ctx.set('Content-disposition', 'attachment; filename=file.tar');
    ctx.set('Content-Type', 'application/x-tar');
  }
};

But in general, you should not really store any important files on the local App Platform storage as it is ephemeral, meaning that all of the information on the local storage gets lost after a deployment.

For permanent storage, you should either store your data in a database on an S3 storage like the DigitalOcean Spaces.

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel