in components/processing/libs/processor-base/src/processors/base/gcsio.py [0:0]
def write_as_file(self):
"""Write file or object as a file"""
logger.debug("Writing %s as file locally", str(self))
# If a file, read directly (make sure created first)
if not self.bucket:
os.makedirs(Path(self.path).parent, exist_ok=True)
yield str(self)
return
with tempfile.NamedTemporaryFile(suffix=self.suffix) as w:
yield w.name
self.bucket.blob(self.path).upload_from_filename(
w.name,
content_type=get_mimetype(self.path),
)