压缩保存在Google云端存储中的文件 [英] Compress files saved in Google cloud storage

查看:69
本文介绍了压缩保存在Google云端存储中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以压缩已保存在Google云存储中的文件?

Is it possible to compress a file already saved in Google cloud storage?

这些文件是由Google数据流代码创建和填充的.数据流无法写入压缩文件,但我的要求是将其保存为压缩格式.

The files are created and populated by Google dataflow code. Dataflow cannot write to a compressed file but my requirement is to save it in compressed format.

推荐答案

您可以编写一个应用程序(也许使用App Engine或Compute Engine)来执行此操作.您将在存储桶上配置通知,以便在写入新对象后通知您的应用,然后运行,读取对象,对其进行压缩,覆盖该对象并设置Content-Encoding元数据字段.因为对象写是事务性的,所以对象的压缩形式在完成之前是不可见的.请注意,如果您执行此操作,则消耗数据的任何应用程序/服务都需要能够处理压缩或未压缩格式.作为替代方案,您可以更改数据流设置,以便将其输出到一个临时存储区,并为该存储区设置通知以使您的压缩程序运行-然后该程序会将压缩后的版本写入您的生产存储区并删除未压缩的对象.

You could write an app (perhaps using App Engine or Compute Engine) to do this. You would configure notifications on the bucket so your app is notified when a new object is written, and then runs, reads the object, compresses it, and overwrites the object and sets the Content-Encoding metadata field. Because object writes are transactional the compressed form of your object wouldn't become visible until it's complete. Note that if you do this any apps/services that consume the data would need to be able to handle either compressed or uncompressed formats. As an alternative, you could change your dataflow setup so it outputs to a temporary bucket, and set up notifications for that bucket to cause your compression program to run -- and that program then would write the compressed version to your production bucket and delete the uncompressed object.

这篇关于压缩保存在Google云端存储中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆