Get and update file meta information
Updated at:2025-11-03
File metadata, or object metadata, describes the attributes of files uploaded to BOS. It includes two types: HTTP standard attributes (HTTP headers) and user-defined metadata.
Get file meta information
Refer to Get only ObjectMetadata.
Modify file meta information
BOS modifies object metadata by copying the object. When copying, set the destination bucket and object as the source bucket and object, then apply the new metadata. If new metadata is not specified, an error will occur.
Ruby
1user_metadata = { "key1" => "value1" }
2options = {
3 'user-metadata' => user_metadata
4}
5client.copy_object(bucket_name, object_name, bucket_name, object_name, options)
6puts client.get_object_meta_data(bucket_name, object_name)['user-metadata']['key1']
