简体   繁体   English

Google云端存储获取对象大小api

[英]Google cloud storage get object size api

Is there a way to get the size in bytes of a folder from google cloud storage through an API? 有没有办法通过API从谷歌云存储中获取文件夹的大小(以字节为单位)? I saw there is a du command for the https://cloud.google.com/storage/docs/gsutil/commands/du for gsutil. 我看到有一个针对gsutil的https://cloud.google.com/storage/docs/gsutil/commands/du的du命令。 But I didn't find anywhere if it is possible to get this data through an API. 但是,如果可以通过API获取此数据,我没有找到任何地方。

I found that this can be done by calling the list method from this api https://cloud.google.com/storage/docs/json_api/v1/objects . 我发现可以通过调用此api https://cloud.google.com/storage/docs/json_api/v1/objects中的list方法来完成此操作。 The objects have a size property and you can put a prefix if you want the get only the objects from a specific path. 对象具有size属性,如果希望仅获取特定路径中的对象,则可以放置前缀。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM