Skip to content Skip to sidebar Skip to footer

How To Use Curl To Send File To Google Cloud Function?

I have the following Cloud function which is mainly based from the documentation: def hello_world(request): if request.method == 'GET': print('GET') elif request.me

Solution 1:

You should be able to do something similar to:

curl \
--form file1=@filename1 \
--form file2=@filename2 \
...\
https://...

An alternative -- possibly better -- solution would be to post the files directly to Google Cloud Storage and then trigger your Cloud Function to process these files (possibly moving from a source|receive bucket into a destination|processed bucket too):

https://cloud.google.com/functions/docs/writing/http#uploading_files_via_cloud_storage

Minor: I think, for this case, POST is preferable to PUT.


Post a Comment for "How To Use Curl To Send File To Google Cloud Function?"