fun quickstart()

in storage/src/main/kotlin/Quickstart.kt [26:37]


fun quickstart(bucketName: String) {
    // [START storage_quickstart]
    // import com.google.cloud.storage.StorageOptions
    val storage = StorageOptions.getDefaultInstance().service
    val bucket = storage.get(bucketName) ?: error("Bucket $bucketName does not exist.")

    println("Listing all blobs in bucket $bucketName:")
    bucket.list().iterateAll().forEach { blob ->
        println("${blob.name} (content-type: ${blob.contentType}, size: ${blob.size})")
    }
    // [END storage_quickstart]
}