0
votes

I currently have a script which saves a csv file locally and then uploads it to Google Cloud storage.

I'm looking to migrate this application to Google App Engine, however I understand you're not able to write files directly to the local file system and this needs to be done directly to Google Cloud storage.

To be honest I'm unsure how to pass the csv data directly in to an upload.

Should I be using any read and write streams?

Any help greatly appreciated.

1

1 Answers

0
votes

You are kind of right. You can't write to disk while using App Engine Standard, but, on the Flexible environment, you can!

Also, as you have tagged this question with the node.js tag, I assume your code is written in that language. Even better, since, if you want to use it in App Engine, you must use Flexible, since node.js can't be run on App Engine Standard.

So, you can move this code to App Engine Flexible without any hassle.

You could also move this code to Cloud Functions, but you can only write temporary files in a function instance in the /tmp directory. Note that it will consume memory resources provisioned for the function.

You should be able to continue using you code as you already have it, only modifying where to write the temp file (if you use Cloud Functions).

EDIT:

When I wrote this, Node was only available in Flexible, but this is no longer the case: Enter Node.js in App Engine Standard.

But, this doesn't change anything on your case: you still can't write to disk while using Standard, so, Flexible, or Cloud Functions, are your best options.