Frank
Frank

Reputation: 442

save file to google cloud working directory

Good morning. I am working in development with nodejs in local and I generate a .csv file Once generated, I save it in the local system directory using library 'objects-to-csv';

Through the function:

     // New file csv
    const csv1 = new ObjectsToCsv(coordenadas);
    
    // Save to file:
    await csv1.toDisk('./coordenadas.csv');
   
  })()

If I deploy the application in google cloud, it works, however it reads the coordinates.csv file but does not rewrite it. There is some method without using storage? Thank you

Upvotes: 0

Views: 125

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75745

When you use serverless application (App Engine, CLoud Run, Cloud functions) your code is packaged into a container. Thus, you can't write in it, only read. In each product, you still have an "in-memory" file system in /tmp

So, use this directory to write the file and to serve it to your user. But, be careful, it's an in-memory file system. If you don't purge it (after the user download), you will reach the maximum allowed memory size and your instance will crash.

Upvotes: 1

Related Questions