Module blob (3.5.0)

Create / interact with Google Cloud Storage blobs.

Classes

Blob

Blob(name,bucket,chunk_size=None,encryption_key=None,kms_key_name=None,generation=None,)

A wrapper around Cloud Storage's concept of anObject.

Parameters
NameDescription
namestr

The name of the blob. This corresponds to the unique path of the object in the bucket. If bytes, will be converted to a unicode object. Blob / object names can contain any sequence of valid unicode characters, of length 1-1024 bytes when UTF-8 encoded.

bucketBucket

The bucket to which this blob belongs.

chunk_sizeint

(Optional) The size of a chunk of data whenever iterating (in bytes). This must be a multiple of 256 KB per the API specification. If not specified, the chunk_size of the blob itself is used. If that is not specified, a default value of 40 MB is used.

encryption_keybytes

(Optional) 32 byte encryption key for customer-supplied encryption. Seehttps://cloud.google.com/storage/docs/encryption#customer-supplied.

kms_key_namestr

(Optional) Resource name of Cloud KMS key used to encrypt the blob's contents.

generationlong

(Optional) If present, selects a specific revision of this object.

Retention

Retention(blob,mode=None,retain_until_time=None,retention_expiration_time=None)

Map an object's retention configuration.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-11-05 UTC.