Gradle compile 'com.google.cloud:google-cloud-storage:1.7.0'
java-
URL- gs://some-bucket-name.appspot.com/directory/some_blob.zip, STORAGE_BUCKET some-bucket-name.appspot.com
directory/some_blob.zip
private long getSize(String path) {
Storage storage = StorageOptions.newBuilder()
.setProjectId(STORAGE_BUCKET)
.build()
.getService();
Blob blob = storage.get(STORAGE_BUCKET, path, Storage.BlobGetOption.fields(Storage.BlobField.SIZE));
if (blob != null) {
return blob.getSize();
}
return 0;
}