in src/gcf/main.py [0:0]
def gcs_write(bucket_name, file_name, content):
"""Write and read a blob from GCS using file-like IO.
Args:
bucket_name: name of the GCS bucket where content will be stored
file_name: name of the file
content: content to be stored into the file
"""
storage_client = storage.Client()
bucket = storage_client.bucket(bucket_name)
blob = bucket.blob(file_name)
# write the <content> into the file/blob
with blob.open("w") as fp:
fp.write(content)