Object management

BOS

  • Function Release Records
  • Product Announcement
  • S3
    • Overview
    • Compatible Interfaces
    • Compatible Signature Authentication
    • Service domain
    • Compatible Common Headers
    • Compatible Tools
  • Security and compliance
    • Overview
    • Monitoring and Audit
    • Data Disaster Recovery
    • Access control
    • Data protection
    • Data Retention Compliance
    • Data encryption
  • API Reference
    • Interface Specifications
    • Audio and Video Processing Interface
    • Access control
    • Introduction
    • Error code
    • Upload callback
    • Service-Related Interface
      • ListBuckets
      • Quota management
        • DeleteUserQuota
        • PutUserQuota
        • GetUserQuota
    • Image Moderation Service Interface
      • Politician Recognition (Politician)
      • Disgusting Image Recognition (Disgust)
      • API description
      • Watermark and QR Code Recognition (Watermark)
      • Face Detection (Face)
      • Image Quality Recognition (Quality)
      • General Text Recognition (OCR)
      • Pornography Recognition (Antiporn)
      • Public Figure Recognition (Public)
      • Terror Recognition (Terror)
    • Multipart Upload-Related Interface
      • AbortMultipartUpload
      • ListMultipartUploads
      • ListParts
      • User guide
      • UploadPart
      • InitiateMultipartUpload
      • UploadPartCopy
      • CompleteMultipartUpload
    • Bucket-Related Interface
      • Original image protection
        • PutBucketCopyrightProtection
        • GetCopyrightProtection
        • DeleteCopyrightProtection
      • Tag Management
        • PutBucketTagging
        • DeleteBucketTagging
        • GetBucketTagging
      • Quota management
        • PutBucketQuota
        • GetBucketQuota
        • DeleteBucketQuota
      • Data encryption
        • GetBucketEncryption
        • DeleteBucketEncryption
        • PutBucketEncryption
      • Event notification
        • PostResult
        • DeleteNotification
        • PostEvent
        • GetNotification
        • PutNotification
      • Recycle bin
        • DeleteBucketTrash
        • GetBucketTrash
        • PutBucketTrash
      • Data synchronization
        • GetBucketReplicationProgress
        • ListBucketReplication
        • GetBucketReplication
        • PutBucketReplication
        • DeleteBucketReplication
      • Cross-Origin Access
        • GetBucketCors
        • PutBucketCors
        • DeleteBucketCors
      • Mirror back-to-origin
        • PutBucketMirroring
        • DeleteBuketMirroring
        • GetBucketMirroring
      • Basic Operations
        • GetBucketLocation
        • HeadBucket
        • PutBucketStorageclass
        • PutBucket
        • GetBucketStorageClass
        • DeleteBucket
      • Lifecycle
        • DeleteBucketLifecycle
        • GetBucketLifecycle
        • PutBucketLifecycle
      • Permission control
        • PutBucketAcl
        • GetBucketAcl
      • Compliance retention
        • ExtendBucketObjectLock
        • DeleteBucketObjectLock
        • CompleteBucketObjectLock
        • InitBucketObjectLock
        • GetBucketObjectLock
      • Bucket inventory
        • GetBucketInventory
        • ListBucketInventory
        • DeleteBucketInventory
        • PutBucketInventory
      • Requester Pays
        • GetBucketRequestPayment
        • PutBucketRequestPayment
      • Static Website
        • PutBucketStaticWebsite
        • DeleteBucketStaticWebsite
        • GetBucketStaticWebsite
      • Versioning
        • PutBucketVersioning
        • GetBucketVersioning
      • Logging
        • DeleteBucketLogging
        • GetBucketLogging
        • PutBucketLogging
    • Object-Related Interface
      • Object Tag
        • PutObjectTagging
        • GetObjectTagging
        • DeleteObjectTagging
      • Basic Operations
        • CopyObject
        • ListObjects
        • FetchObject
        • GetObjectMeta
        • PostObject
        • listObjectVersions
        • DeleteObject
        • PutObject
        • AppendObject
        • DeleteMultipleObjects
        • RestoreObject
        • GetObject
        • OPTIONSObject
      • Soft links
        • GetSymlink
        • PutSymlink
      • Permission control
        • GetObjectAcl
        • PutObjectAcl
        • DeleteObjectAcl
      • Select scanning
        • SelectObject
  • Console Operation Guide
    • Hierarchical Namespace Bucket Operation Instructions
    • Configuring BOS Multi-User Access Control
    • Image Service
    • Operation preparation
    • Favorite Path
    • Quota management
    • Linkage with Baidu Netdisk sharing
    • Online data import
    • Statistics and monitoring
    • Intelligent Business Analysis
    • Event Notification and Data Processing
    • View and export usage data
    • Image Review Service
    • Automatic file decompression
    • Data Publishing
      • Data Publishing Introduction
      • Global Acceleration
      • Creating a Bucket Custom Domain Name
      • Viewing Bucket Official Domain Name
      • Configure Cache Management
      • Enabling CDN Official Acceleration Domain Name
      • Configuring CDN Upload Acceleration
    • Global Settings
      • VPC Access Control
    • Managing Bucket
      • Set static website hosting
      • Setting Up Log Query
      • Set referer allow list
      • Create bucket
      • Set cross-origin access
      • Set bucket trash
      • Set mirror back-to-origin
      • Set access logs
      • Set server-side encryption
      • Set storage inventory
      • Managing Bucket Tag
      • Querying Bucket
      • Data access trend analysis
      • Bucket quota management
      • Set compliance retention
      • Bucket overview
      • Set data synchronization
      • Setting Up Versioning
      • Requester Pays
      • Delete bucket
      • Managing Lifecycle
        • Overview
        • Configure intelligent tiering
        • Configuring Basic Lifecycle Management
        • Basic Lifecycle Management Usage Instructions
          • Lifecycle Rule Based on Last Accessed Time
          • Lifecycle Rule Based on Last Modified Time
      • Set bucket read-write permissions
        • Permission Introduction
        • Set bucket read-write permissions
    • Manage object
      • Setting Symlink
      • Select scanning
      • Setting Meta Information
      • Share files - get file URLs
      • Parts management
      • Folder sharing
      • Restore Archived Files
      • Delete file
      • Copy and move files
      • Delete folders in batches
      • Batch Managing Object
      • Folder statistics
      • Renamed files
      • Convert file storage class
      • Set file permissions
      • Download file
      • Querying Object
      • Upload files
      • Managing Folder
      • Object Tag
  • Managing Bucket
    • Set static website hosting
    • Set referer allow list
    • Create bucket
    • Set bucket trash
    • Set mirror back-to-origin
    • Set access logs
    • Set server-side encryption
    • Set storage inventory
    • Managing Bucket Tag
    • Bucket quota management
    • Set compliance retention
    • Bucket overview
    • Set data synchronization
    • Requester Pays
    • Delete bucket
    • _Archive
      • Set static website hosting
      • Set referer allow list
      • Create bucket
      • Set cross-origin access
      • Set bucket trash
      • Set mirror back-to-origin
      • Set access logs
      • Set server-side encryption
      • Set storage inventory
      • Managing Bucket Tag
      • Querying Bucket
      • Bucket quota management
      • Set compliance retention
      • Bucket overview
      • Set data synchronization
      • Requester Pays
      • Delete bucket
    • Set bucket read-write permissions
      • Permission Introduction
      • Set bucket read-write permissions
      • _Archive
        • Permission Introduction
        • Set bucket read-write permissions
  • Content Review
    • Video Review
    • Image audit
  • Service Level Agreement (SLA)
    • BOS Service Level Agreement SLA (V3_0)
    • Baidu AI Cloud Object Storage (BOS) Trusted Cloud Certification
  • Data processing
    • Image audit
    • Data Processing FAQs
    • Document preview
    • Video frame capture
    • Instant video transcoding
    • Data Processing Introduction
    • Image Processing Terminology Explanation
    • Multimedia cloud processing
    • Get video metadata
    • General Image Settings
      • Original image protection
    • Intelligent Recognition
      • Overview
    • Image Processing Guide V2_0
      • Removing Metadata
      • Image Scaling
      • Image Brightness
      • Getting Image Information
      • Image Blur
      • Usage rules
      • Image Resizing
      • Quality Transformation
      • Format conversion
      • Progressive Display
      • Image Sharpening
      • Grayscale Transformation
      • Image Contrast
      • Image Rotation
        • Normal Rotation
        • Adaptive Rotation
      • Intelligent Processing
        • Intelligent Processing Usage Rules
        • Intelligent Scenarios
          • Lossless magnification
          • Portrait Cartoonization
          • Sky Segmentation
          • Style conversion
          • Black and white coloring
          • Stretch Restoration
          • Object erasure
        • Intelligent Effects
          • Intelligent Contrast
          • Intelligent Sharpness
          • Intelligent defogging
          • Intelligent Color Grading
      • Image Cropping
        • Rounded-corner rectangle cropping
        • Incircle Crop
        • Normal Crop
        • Index Crop
      • Image Watermark
        • Add Image-Text Mixed Watermark
        • Add Text Watermark
        • Add image watermark
    • Image Processing Guide V1_0
      • Image Cropping
      • Getting Image Information
      • Image Thumbnailing
      • Usage rules
      • Quality Transformation
      • Format conversion
      • Watermark
      • Progressive Display
      • Image Rotation
  • Peripheral Tools
    • fsspec-bosfs
    • Peripheral Tools Overview
    • BOS-FTP Tool
    • Download Zone
    • BOS-AlluxioExtension Tool
    • BOS-PC Client
      • FAQs
      • User guide
      • Installation and Login
    • BOS-HDFS Tool
      • Overview
      • Configuration and Usage
      • Big Data Component Usage Guide
        • DataX Reading and Writing BOS
        • Hive Usage Guide
        • Presto Usage Guide
        • Spark Usage Guide
        • Flume Data Storage to BOS
        • Flink Usage Guide
        • Impala Usage Guide
    • BOS-Probe Error Detection Tool
      • Overview
      • Suggestions and Report Viewing
      • Checking Uploads and Downloads via BOSProbe
      • Installing BOSProbe
    • Docker
      • Overview
    • BOS-CMD Command-Line Tool
      • Configure BCECMD Command-Line Completion
      • Install BOSCMD
      • Overview
      • FAQs
      • Use BOS Service via CMD
      • BOS CMD Common Issues
      • BOSCMD Version Change Records
      • Configure BOSCMD
    • BOS-Import Data Cloud Migration Tool
      • Configuration file
      • Deployment methods
      • Overview
      • Version records
      • Exception handling
      • Log
      • Task Progress Recovery
    • BOS-FS Mount Tool
      • Operations and Practices
      • Overview
      • Version Change Records
      • FAQs
      • Install
      • Configuration
    • BOS-API Generation Tool
      • Overview
      • Service-Related Interface
        • List Buckets
        • Quota management
          • Delete User Credit Quota Settings
          • Get User Credit Quota Information
          • Set User Credit Quota
      • Image Moderation Service Interface
        • Image Review Interface
      • How to Call the API
        • Authentication
        • Construct a Request
        • Return a Response
      • Bucket Data Synchronization Related Interfaces
        • Retrieving the Process Status of Data Synchronization for a Specified ID in a Bucket
        • Setting Up Bucket Data Synchronization
        • Deleting the Synchronization Replication Configuration of a Specified ID in a Bucket
        • Listing All Replication Synchronization Rules of a Bucket
        • Retrieving Bucket Data Synchronization Information
      • Bucket-Related Interface
        • Original image protection
          • Disabling Bucket Original Image Protection Configuration
          • Get the original image protection configuration of bucket
          • Enable the original image protection function of bucket
        • Data encryption
          • Check If Encryption Is Enabled for a Bucket
          • Disable Server-Side Encryption (SSE) for a Bucket
          • Enable Encryption for a Bucket
        • Event notification
          • Setting Up Bucket Notification Rules
          • Retrieving Bucket Notification Rules
          • Pushing ImageOcr and ImageClassify Messages
          • Deleting Bucket Notification Rules
          • Pushing Event Messages
        • Recycle bin
          • Retrieving the Activation Status of the Bucket Recycle Bin
          • Disabling Bucket Recycle Bin Functionality
          • Enabling Bucket Recycle Bin Functionality
        • Cross-Origin Access
          • Get Cross-Origin Resource Sharing (CORS) Rules Set on a Specified Bucket
          • Disable Cross-Origin Resource Sharing (CORS) Rule on a Specified Bucket
          • Set a Cross-Origin Resource Sharing (CORS) Rule on a Specified Bucket
        • Basic Operations
          • List Buckets
          • Cross-Origin Query
          • Create a bucket
          • Get the Default Storage Class of a Bucket
          • List Objects in a Bucket
          • Set default bucket storage class
          • Get the Region of a Bucket
          • Check If a Bucket Exists and Whether the Requester Has Permission to Access the Bucket
          • Delete bucket
        • Lifecycle
          • Get Lifecycle Management Rules for a Bucket
          • Delete Lifecycle Management Rules for a Bucket
          • Set Lifecycle for a Bucket
        • Permission control
          • Set bucket access permissions
          • Get Access Permission for a Bucket
        • Compliance retention
          • Retrieving Bucket Compliance Retention Policies
          • Deleting Compliance Retention Policies
          • Locking Bucket Compliance Retention Policies
          • Delaying the Protection Period of Bucket Compliance Retention Policies
          • Initializing Compliance Retention Policies
        • Static Website
          • Set static website hosting
          • Delete Static Website Hosting Information for a Bucket
          • Get Static Website Hosting Information for a Bucket
        • Logging
          • Enable bucket access logs
          • Disable Access Log Configuration for a Bucket
          • Get Access Log Configuration for a Bucket
      • Object-Related Interface
        • Basic Operations
          • Get Meta Information of an Object
          • Restore Archived Files
          • Get an Object
          • Fetch an Object and Store It in a Bucket
          • Delete Multiple Objects
          • Delete Object
        • Soft links
          • Retrieve a symlink
          • Create a symlink
        • Permission control
          • Set access permission for an object
          • Delete Access Permission for an Object
          • Get Access Permission for an Object
        • Select scanning
          • Execute SQL Statement on an Object
    • MoonBox Physical Migration Device
      • MoonBox introduction
      • MoonBox Operation Process
    • BOS Connector for PyTorch
      • Overview
      • Functionality and Usage Instructions
      • Reading and Writing Checkpoints
      • Installing BOS Connector for Pytorch
      • Building a Dataset
      • Configuring BOS Connector for Pytorch
      • Performance test
    • BOS-CLI Command-Line Tool (Old Version)
      • Overview
      • Version Change Records
      • Configure BOSCLI
      • Install BOSCLI
      • Use BOS Service via CLI
    • BOS-Util Batch Operation Tool
      • Overview
      • Version Change Records
      • Install BOS-Util
      • Using BOS Service via BOS-Util
    • Third-party tools
      • rclone
      • S3 Browser
      • MinIO
      • Goofys
      • Other Tools
  • Typical Practices
    • Using BOS as Backend Storage Service for Jfrog Artifactory
    • How to Solve Browser Cross-Origin CORS Issues
    • Using HTTPDNS Service via Android SDK
    • Client-Side Encryption Practice
    • BOS Dedicated Line Back-to-Origin IDC Best Practices
    • Presto Practice Based on BOS
    • Accessing BOS via Dedicated Line-VPN in Hybrid Cloud
    • CDN Dynamic Acceleration Uploading Data to BOS
    • HTTPS Transmission Encryption Practice
    • Using CDN to Accelerate BOS
    • Hotlink Protection
    • AWS Lambda Synchronizing S3 Data to BOS
    • Impala Practice Based on BOS
    • Direct Upload of Web Data to BOS
      • Advanced Chapter I - STS Temporary Authentication
      • Basic Chapter - Directly Uploading Files to BOS in the Browser
      • Advanced Chapter II - Handling Older Versions of IE via the PostObject Interface
      • Principle Chapter III - STS Temporary Authentication
      • Principle Chapter I - Directly Uploading Files to BOS in the Browser
      • Principle Chapter II - Upload large file in parts
    • Data Migration
      • Migrating Data from Third-Party Clouds to BOS
      • Migrating Local Data to BOS
      • Scenario overview
    • Mobile Photo Editing App Practice
      • Overview and Scenario Introduction
      • Code example
      • Solution Practice - Building the Photo Editing App
      • Solution Practice - Using the Photo Editing App
    • Accessing BOS via Python API Request
      • Upload File to Bucket via PUT Request
      • Basics (Must-Read) - Generation of authentication string
      • Download Bucket File to Local via GET Request
  • FAQs
    • Certification and permission management
    • Image Service
    • Security Problems
    • Bucket Domain Name Request Style
    • General Problems
    • Object upload-download and management
    • Data Migration and Backup
    • Billing Problems
    • API & SDK & Tools
    • Common Questions Overview
    • Bucket access and management
    • Analysis and Statistic
    • Performance-related questions
  • Video Zone
    • Accessing BOS Resources via Domain Name
    • Object upload
    • Understanding BOS
    • BOS Tiered Storage
  • Quick Start
    • Create bucket
    • Get Object
    • Upload Object
    • Quick Start Guide
    • Getting Started with BOS
    • Delete Object
    • Delete bucket
  • Product pricing
    • Billing Cases
    • Insufficient Balance and Debt Reminder
    • View Consumption Details
    • Billing FAQs
    • Product price
      • Resource Package Price List
      • Pay-As-You-Go Charge Type
      • Pay-As-You-Go Price List
        • Traffic Price
        • Storage prices
        • Data Processing Price
        • Request Price
      • Resource Package Charge Type
        • Resource Package Deduction Rules
        • Resource Package Overview
      • Resource Package Price List - Deprecated
        • Internet downlink traffic package
        • Infrequent access storage package
        • Back-to-origin traffic package
        • Archive storage package
        • Cold storage package
        • Standard storage package
    • Charge Item Introduction
      • Traffic fees
      • Storage Cost
      • Request fees
      • Data processing fees
      • Charge Item Overview
  • SDK
    • SDK Overview
    • Harmony-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Log
      • Bucket management
        • Create Bucket
        • Bucket permission control
        • View the region to which a bucket belongs
        • Bucket Storage Class Setting and Query
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • Object management
        • Object permission control
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • Ruby-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Bucket management
        • Create Bucket
        • List buckets
        • Overview
        • Bucket permission management
        • View the region to which a bucket belongs
        • Check if bucket exists
        • Delete bucket
      • File management
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Copy Object
        • Download file
        • Upload files
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
    • Python-SDK
      • Overview
      • Version Change Records
      • Initialization
      • FAQs
      • Install the SDK Package
      • Exception handling
      • Log Control
      • Bucket management
        • Bucket cross-origin resource access
        • Create Bucket
        • Bucket Recycle Bin
        • List buckets
        • Overview
        • Bucket Inventory Management
        • Mirror back-to-origin
        • Bucket Lifecycle Management
        • Event notification
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • Close Recycle Bin
        • Logging
        • Data synchronization
        • Get Recycle Bin Activation Information
        • Check if bucket exists
        • User Credit Quota Management
        • Original image protection
        • Delete bucket
      • File management
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Copy Object
        • Select file
        • Soft links
        • Download file
        • Upload files
        • Restore archived storage class files
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
    • JavaScript-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Quota management
      • Bucket management
      • Install SDK
      • Bucket management
        • Data Synchronization Configuration
        • Create Bucket
        • Overview
        • Bucket Logging Management
        • Bucket Lifecycle Management
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • Object management
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Get File URL
        • Delete Object
    • Android-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Log
      • Object management
      • Bucket management
        • Create Bucket
        • Bucket permission control
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • File management
        • Object permission control
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • Java-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • FAQs
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Data Processing and Usage
      • Bucket management
      • Bucket management
        • Bucket static website hosting
        • Recycle bin
        • Bucket data synchronization
        • Create Bucket
        • List buckets
        • Overview
        • Mirror back-to-origin
        • Set Bucket server-side encryption
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • Tag Management
        • Check if bucket exists
        • Original image protection
        • Delete bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Get directory capacity overview
        • Select file
        • Download file
        • Upload files
        • Restore archived storage class files
        • List files in the storage space
        • Object Tag
        • Get and update file meta information
        • Check if a file exists
    • IOS-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Log
      • Object management
      • Bucket management
        • Create New Bucket
        • Determine whether the bucket exists and whether there is permission to access it
        • Bucket permission control
        • View bucket list
        • Delete bucket
      • File management
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • GO-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • Install the SDK Package
      • SDK Logging
      • Data Processing and Usage
      • Bucket management
      • Request management
      • Error handling
    • C-Dotnet-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Object management
    • PHP-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • Install the SDK Package
      • Exception handling
      • Bucket management
    • C-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Exception handling
      • Install SDK Toolkit
      • Bucket management
        • Create Bucket
        • List Buckets
        • Overview
        • Check If Bucket Exists
        • Delete Bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Delete file
        • Download file
        • Upload files
        • Archive storage
        • Get and Update Metadata Information
        • Get File Download Link
        • List files in the storage space
        • Check if a file exists
    • C++-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Bucket management
        • Create Bucket
        • List buckets
        • Overview
        • Bucket permission management
        • View the region to which a bucket belongs
        • Check if bucket exists
        • Delete bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Object Tag Management
        • Download file
        • Upload files
        • Archive storage
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
      • Request management
        • Cancel request interruption
  • Product Description
    • Product functions
    • Application scenarios
    • Product advantages
    • Usage restrictions
    • Product introduction
    • Core concepts
    • Tiered Storage Introduction
      • Why Tiered Storage Exists
      • Introduction to storage classes
  • Data Cube
    • Batch processing
    • ZIP packaging and compression
    • Intelligent Data Processing
      • Video processing
        • Video frame capture
        • Instant video transcoding
        • Multimedia cloud processing
        • M3U8 signature
        • Get video metadata
      • Document processing
        • Document preview
      • Image processing
        • Image Processing Introduction
        • Image Processing FAQs
        • Image Processing Terminology Explanation
        • General Image Settings
          • Original image protection
        • Image Processing Guide V2_0
          • Removing Metadata
          • Image Scaling
          • Image Processing Persistence
          • Image Brightness
          • Image Blind Watermark
          • Return Original Image on Failure
          • Getting Image Information
          • Image Blur
          • Usage rules
          • Quality Transformation
          • Format conversion
          • Progressive Display
          • Image Sharpening
          • Grayscale Transformation
          • Image Compression
          • Image Anomaly Detection
          • Image Contrast
          • Image Rotation
            • Normal Rotation
            • Adaptive Rotation
          • Intelligent Processing
            • Intelligent Processing Usage Rules
            • Intelligent Scenarios
              • Lossless magnification
              • Portrait Cartoonization
              • Sky Segmentation
              • Style conversion
              • Black and white coloring
              • Stretch Restoration
              • Object erasure
            • Intelligent Effects
              • Intelligent Contrast
              • Intelligent Sharpness
              • Intelligent defogging
              • Intelligent Color Grading
          • Image Cropping
            • Rounded-corner rectangle cropping
            • Incircle Crop
            • Normal Crop
            • Index Crop
          • Image Watermark
            • Add Image-Text Mixed Watermark
            • Add Text Watermark
            • Add image watermark
        • Image Processing Guide V1_0
          • Image Cropping
          • Getting Image Information
          • Image Thumbnailing
          • Usage rules
          • Quality Transformation
          • Format conversion
          • Watermark
          • Progressive Display
          • Image Rotation
  • Related Agreements
    • Baidu AI Cloud Object Storage (BOS) and Baidu Netdisk Integration Usage Agreement
  • Developer Guide
    • Single-link rate limit
    • Image audit
    • Region and Endpoint
    • Event notification
    • Monitor Service Operations
    • Static website hosting
    • Basic concepts
    • Development Preparation
    • Data Publishing
      • Binding Custom Domain Name
      • CDN Acceleration Publishing
    • Data Disaster Recovery
      • Multi-AZ storage
      • Data synchronization
    • Data Security
      • Set anti-stealing-link
      • Set bucket trash
      • Set server-side encryption
      • Principle of least privilege
      • Permission control
        • Object permission control
        • Bucket permission control
        • IAM primary-IAM user access control
      • Versioning
        • Deletion Mark
        • Versioning Overview
    • Bucket Basic Operations
      • Create bucket
      • Data Publishing
      • Obtaining Bucket Region Information
      • Managing Lifecycle
      • Set access logs
      • Setting Bucket Tag
      • Setting Cross-Origin Resource Sharing (CORS)
      • View bucket list
      • Delete bucket
    • Data lifecycle management
      • Intelligent Business Analysis
    • Data Migration to Cloud
      • Migration from other clouds
      • Local data to cloud
      • Scenario overview
    • Data lake access
      • Hierarchical namespace
      • Metadata Conversion Service
    • Object Basic Operations
      • Managing Files
        • Copy data
        • Select scanning
        • Delete data
        • Obtaining Data Metadata
        • Viewing File List
        • Object Tag
      • Uploading Data
        • Simple upload
        • Append upload
        • Form upload
        • Upload callback
        • Chunking and Resumable Upload
      • Downloading Data
        • Simple Download
        • Resumable download
  • Data Lake Storage
    • Big Data Component Usage Guide
      • HBase Uses BOS as Underlying Storage
      • Kafka Data Storage to BOS
      • Hive Usage Guide
      • Presto Usage Guide
      • Spark Usage Guide
      • Flume Data Storage to BOS
      • Flink Usage Guide
      • Impala Usage Guide
      • Fluentd Collects Data Storage to BOS
      • Logstash Data Storage to BOS
      • Elasticsearch Snapshot Data Storage to BOS
      • Druid Uses BOS as Deep Storage
    • BOS HDFS tool
      • Overview
      • FAQs
      • Configuration and Usage
    • Data Migration and Transfer
      • Migrate Data to Hierarchical Namespace Bucket Using DistCp
      • DataX Read and Write BOS
    • Hierarchical namespace
      • Usage method
      • Service Introduction
      • Convert Normal Bucket to Hierarchical Namespace Bucket
      • Function Support Description
All documents
menu
No results found, please re-enter

BOS

  • Function Release Records
  • Product Announcement
  • S3
    • Overview
    • Compatible Interfaces
    • Compatible Signature Authentication
    • Service domain
    • Compatible Common Headers
    • Compatible Tools
  • Security and compliance
    • Overview
    • Monitoring and Audit
    • Data Disaster Recovery
    • Access control
    • Data protection
    • Data Retention Compliance
    • Data encryption
  • API Reference
    • Interface Specifications
    • Audio and Video Processing Interface
    • Access control
    • Introduction
    • Error code
    • Upload callback
    • Service-Related Interface
      • ListBuckets
      • Quota management
        • DeleteUserQuota
        • PutUserQuota
        • GetUserQuota
    • Image Moderation Service Interface
      • Politician Recognition (Politician)
      • Disgusting Image Recognition (Disgust)
      • API description
      • Watermark and QR Code Recognition (Watermark)
      • Face Detection (Face)
      • Image Quality Recognition (Quality)
      • General Text Recognition (OCR)
      • Pornography Recognition (Antiporn)
      • Public Figure Recognition (Public)
      • Terror Recognition (Terror)
    • Multipart Upload-Related Interface
      • AbortMultipartUpload
      • ListMultipartUploads
      • ListParts
      • User guide
      • UploadPart
      • InitiateMultipartUpload
      • UploadPartCopy
      • CompleteMultipartUpload
    • Bucket-Related Interface
      • Original image protection
        • PutBucketCopyrightProtection
        • GetCopyrightProtection
        • DeleteCopyrightProtection
      • Tag Management
        • PutBucketTagging
        • DeleteBucketTagging
        • GetBucketTagging
      • Quota management
        • PutBucketQuota
        • GetBucketQuota
        • DeleteBucketQuota
      • Data encryption
        • GetBucketEncryption
        • DeleteBucketEncryption
        • PutBucketEncryption
      • Event notification
        • PostResult
        • DeleteNotification
        • PostEvent
        • GetNotification
        • PutNotification
      • Recycle bin
        • DeleteBucketTrash
        • GetBucketTrash
        • PutBucketTrash
      • Data synchronization
        • GetBucketReplicationProgress
        • ListBucketReplication
        • GetBucketReplication
        • PutBucketReplication
        • DeleteBucketReplication
      • Cross-Origin Access
        • GetBucketCors
        • PutBucketCors
        • DeleteBucketCors
      • Mirror back-to-origin
        • PutBucketMirroring
        • DeleteBuketMirroring
        • GetBucketMirroring
      • Basic Operations
        • GetBucketLocation
        • HeadBucket
        • PutBucketStorageclass
        • PutBucket
        • GetBucketStorageClass
        • DeleteBucket
      • Lifecycle
        • DeleteBucketLifecycle
        • GetBucketLifecycle
        • PutBucketLifecycle
      • Permission control
        • PutBucketAcl
        • GetBucketAcl
      • Compliance retention
        • ExtendBucketObjectLock
        • DeleteBucketObjectLock
        • CompleteBucketObjectLock
        • InitBucketObjectLock
        • GetBucketObjectLock
      • Bucket inventory
        • GetBucketInventory
        • ListBucketInventory
        • DeleteBucketInventory
        • PutBucketInventory
      • Requester Pays
        • GetBucketRequestPayment
        • PutBucketRequestPayment
      • Static Website
        • PutBucketStaticWebsite
        • DeleteBucketStaticWebsite
        • GetBucketStaticWebsite
      • Versioning
        • PutBucketVersioning
        • GetBucketVersioning
      • Logging
        • DeleteBucketLogging
        • GetBucketLogging
        • PutBucketLogging
    • Object-Related Interface
      • Object Tag
        • PutObjectTagging
        • GetObjectTagging
        • DeleteObjectTagging
      • Basic Operations
        • CopyObject
        • ListObjects
        • FetchObject
        • GetObjectMeta
        • PostObject
        • listObjectVersions
        • DeleteObject
        • PutObject
        • AppendObject
        • DeleteMultipleObjects
        • RestoreObject
        • GetObject
        • OPTIONSObject
      • Soft links
        • GetSymlink
        • PutSymlink
      • Permission control
        • GetObjectAcl
        • PutObjectAcl
        • DeleteObjectAcl
      • Select scanning
        • SelectObject
  • Console Operation Guide
    • Hierarchical Namespace Bucket Operation Instructions
    • Configuring BOS Multi-User Access Control
    • Image Service
    • Operation preparation
    • Favorite Path
    • Quota management
    • Linkage with Baidu Netdisk sharing
    • Online data import
    • Statistics and monitoring
    • Intelligent Business Analysis
    • Event Notification and Data Processing
    • View and export usage data
    • Image Review Service
    • Automatic file decompression
    • Data Publishing
      • Data Publishing Introduction
      • Global Acceleration
      • Creating a Bucket Custom Domain Name
      • Viewing Bucket Official Domain Name
      • Configure Cache Management
      • Enabling CDN Official Acceleration Domain Name
      • Configuring CDN Upload Acceleration
    • Global Settings
      • VPC Access Control
    • Managing Bucket
      • Set static website hosting
      • Setting Up Log Query
      • Set referer allow list
      • Create bucket
      • Set cross-origin access
      • Set bucket trash
      • Set mirror back-to-origin
      • Set access logs
      • Set server-side encryption
      • Set storage inventory
      • Managing Bucket Tag
      • Querying Bucket
      • Data access trend analysis
      • Bucket quota management
      • Set compliance retention
      • Bucket overview
      • Set data synchronization
      • Setting Up Versioning
      • Requester Pays
      • Delete bucket
      • Managing Lifecycle
        • Overview
        • Configure intelligent tiering
        • Configuring Basic Lifecycle Management
        • Basic Lifecycle Management Usage Instructions
          • Lifecycle Rule Based on Last Accessed Time
          • Lifecycle Rule Based on Last Modified Time
      • Set bucket read-write permissions
        • Permission Introduction
        • Set bucket read-write permissions
    • Manage object
      • Setting Symlink
      • Select scanning
      • Setting Meta Information
      • Share files - get file URLs
      • Parts management
      • Folder sharing
      • Restore Archived Files
      • Delete file
      • Copy and move files
      • Delete folders in batches
      • Batch Managing Object
      • Folder statistics
      • Renamed files
      • Convert file storage class
      • Set file permissions
      • Download file
      • Querying Object
      • Upload files
      • Managing Folder
      • Object Tag
  • Managing Bucket
    • Set static website hosting
    • Set referer allow list
    • Create bucket
    • Set bucket trash
    • Set mirror back-to-origin
    • Set access logs
    • Set server-side encryption
    • Set storage inventory
    • Managing Bucket Tag
    • Bucket quota management
    • Set compliance retention
    • Bucket overview
    • Set data synchronization
    • Requester Pays
    • Delete bucket
    • _Archive
      • Set static website hosting
      • Set referer allow list
      • Create bucket
      • Set cross-origin access
      • Set bucket trash
      • Set mirror back-to-origin
      • Set access logs
      • Set server-side encryption
      • Set storage inventory
      • Managing Bucket Tag
      • Querying Bucket
      • Bucket quota management
      • Set compliance retention
      • Bucket overview
      • Set data synchronization
      • Requester Pays
      • Delete bucket
    • Set bucket read-write permissions
      • Permission Introduction
      • Set bucket read-write permissions
      • _Archive
        • Permission Introduction
        • Set bucket read-write permissions
  • Content Review
    • Video Review
    • Image audit
  • Service Level Agreement (SLA)
    • BOS Service Level Agreement SLA (V3_0)
    • Baidu AI Cloud Object Storage (BOS) Trusted Cloud Certification
  • Data processing
    • Image audit
    • Data Processing FAQs
    • Document preview
    • Video frame capture
    • Instant video transcoding
    • Data Processing Introduction
    • Image Processing Terminology Explanation
    • Multimedia cloud processing
    • Get video metadata
    • General Image Settings
      • Original image protection
    • Intelligent Recognition
      • Overview
    • Image Processing Guide V2_0
      • Removing Metadata
      • Image Scaling
      • Image Brightness
      • Getting Image Information
      • Image Blur
      • Usage rules
      • Image Resizing
      • Quality Transformation
      • Format conversion
      • Progressive Display
      • Image Sharpening
      • Grayscale Transformation
      • Image Contrast
      • Image Rotation
        • Normal Rotation
        • Adaptive Rotation
      • Intelligent Processing
        • Intelligent Processing Usage Rules
        • Intelligent Scenarios
          • Lossless magnification
          • Portrait Cartoonization
          • Sky Segmentation
          • Style conversion
          • Black and white coloring
          • Stretch Restoration
          • Object erasure
        • Intelligent Effects
          • Intelligent Contrast
          • Intelligent Sharpness
          • Intelligent defogging
          • Intelligent Color Grading
      • Image Cropping
        • Rounded-corner rectangle cropping
        • Incircle Crop
        • Normal Crop
        • Index Crop
      • Image Watermark
        • Add Image-Text Mixed Watermark
        • Add Text Watermark
        • Add image watermark
    • Image Processing Guide V1_0
      • Image Cropping
      • Getting Image Information
      • Image Thumbnailing
      • Usage rules
      • Quality Transformation
      • Format conversion
      • Watermark
      • Progressive Display
      • Image Rotation
  • Peripheral Tools
    • fsspec-bosfs
    • Peripheral Tools Overview
    • BOS-FTP Tool
    • Download Zone
    • BOS-AlluxioExtension Tool
    • BOS-PC Client
      • FAQs
      • User guide
      • Installation and Login
    • BOS-HDFS Tool
      • Overview
      • Configuration and Usage
      • Big Data Component Usage Guide
        • DataX Reading and Writing BOS
        • Hive Usage Guide
        • Presto Usage Guide
        • Spark Usage Guide
        • Flume Data Storage to BOS
        • Flink Usage Guide
        • Impala Usage Guide
    • BOS-Probe Error Detection Tool
      • Overview
      • Suggestions and Report Viewing
      • Checking Uploads and Downloads via BOSProbe
      • Installing BOSProbe
    • Docker
      • Overview
    • BOS-CMD Command-Line Tool
      • Configure BCECMD Command-Line Completion
      • Install BOSCMD
      • Overview
      • FAQs
      • Use BOS Service via CMD
      • BOS CMD Common Issues
      • BOSCMD Version Change Records
      • Configure BOSCMD
    • BOS-Import Data Cloud Migration Tool
      • Configuration file
      • Deployment methods
      • Overview
      • Version records
      • Exception handling
      • Log
      • Task Progress Recovery
    • BOS-FS Mount Tool
      • Operations and Practices
      • Overview
      • Version Change Records
      • FAQs
      • Install
      • Configuration
    • BOS-API Generation Tool
      • Overview
      • Service-Related Interface
        • List Buckets
        • Quota management
          • Delete User Credit Quota Settings
          • Get User Credit Quota Information
          • Set User Credit Quota
      • Image Moderation Service Interface
        • Image Review Interface
      • How to Call the API
        • Authentication
        • Construct a Request
        • Return a Response
      • Bucket Data Synchronization Related Interfaces
        • Retrieving the Process Status of Data Synchronization for a Specified ID in a Bucket
        • Setting Up Bucket Data Synchronization
        • Deleting the Synchronization Replication Configuration of a Specified ID in a Bucket
        • Listing All Replication Synchronization Rules of a Bucket
        • Retrieving Bucket Data Synchronization Information
      • Bucket-Related Interface
        • Original image protection
          • Disabling Bucket Original Image Protection Configuration
          • Get the original image protection configuration of bucket
          • Enable the original image protection function of bucket
        • Data encryption
          • Check If Encryption Is Enabled for a Bucket
          • Disable Server-Side Encryption (SSE) for a Bucket
          • Enable Encryption for a Bucket
        • Event notification
          • Setting Up Bucket Notification Rules
          • Retrieving Bucket Notification Rules
          • Pushing ImageOcr and ImageClassify Messages
          • Deleting Bucket Notification Rules
          • Pushing Event Messages
        • Recycle bin
          • Retrieving the Activation Status of the Bucket Recycle Bin
          • Disabling Bucket Recycle Bin Functionality
          • Enabling Bucket Recycle Bin Functionality
        • Cross-Origin Access
          • Get Cross-Origin Resource Sharing (CORS) Rules Set on a Specified Bucket
          • Disable Cross-Origin Resource Sharing (CORS) Rule on a Specified Bucket
          • Set a Cross-Origin Resource Sharing (CORS) Rule on a Specified Bucket
        • Basic Operations
          • List Buckets
          • Cross-Origin Query
          • Create a bucket
          • Get the Default Storage Class of a Bucket
          • List Objects in a Bucket
          • Set default bucket storage class
          • Get the Region of a Bucket
          • Check If a Bucket Exists and Whether the Requester Has Permission to Access the Bucket
          • Delete bucket
        • Lifecycle
          • Get Lifecycle Management Rules for a Bucket
          • Delete Lifecycle Management Rules for a Bucket
          • Set Lifecycle for a Bucket
        • Permission control
          • Set bucket access permissions
          • Get Access Permission for a Bucket
        • Compliance retention
          • Retrieving Bucket Compliance Retention Policies
          • Deleting Compliance Retention Policies
          • Locking Bucket Compliance Retention Policies
          • Delaying the Protection Period of Bucket Compliance Retention Policies
          • Initializing Compliance Retention Policies
        • Static Website
          • Set static website hosting
          • Delete Static Website Hosting Information for a Bucket
          • Get Static Website Hosting Information for a Bucket
        • Logging
          • Enable bucket access logs
          • Disable Access Log Configuration for a Bucket
          • Get Access Log Configuration for a Bucket
      • Object-Related Interface
        • Basic Operations
          • Get Meta Information of an Object
          • Restore Archived Files
          • Get an Object
          • Fetch an Object and Store It in a Bucket
          • Delete Multiple Objects
          • Delete Object
        • Soft links
          • Retrieve a symlink
          • Create a symlink
        • Permission control
          • Set access permission for an object
          • Delete Access Permission for an Object
          • Get Access Permission for an Object
        • Select scanning
          • Execute SQL Statement on an Object
    • MoonBox Physical Migration Device
      • MoonBox introduction
      • MoonBox Operation Process
    • BOS Connector for PyTorch
      • Overview
      • Functionality and Usage Instructions
      • Reading and Writing Checkpoints
      • Installing BOS Connector for Pytorch
      • Building a Dataset
      • Configuring BOS Connector for Pytorch
      • Performance test
    • BOS-CLI Command-Line Tool (Old Version)
      • Overview
      • Version Change Records
      • Configure BOSCLI
      • Install BOSCLI
      • Use BOS Service via CLI
    • BOS-Util Batch Operation Tool
      • Overview
      • Version Change Records
      • Install BOS-Util
      • Using BOS Service via BOS-Util
    • Third-party tools
      • rclone
      • S3 Browser
      • MinIO
      • Goofys
      • Other Tools
  • Typical Practices
    • Using BOS as Backend Storage Service for Jfrog Artifactory
    • How to Solve Browser Cross-Origin CORS Issues
    • Using HTTPDNS Service via Android SDK
    • Client-Side Encryption Practice
    • BOS Dedicated Line Back-to-Origin IDC Best Practices
    • Presto Practice Based on BOS
    • Accessing BOS via Dedicated Line-VPN in Hybrid Cloud
    • CDN Dynamic Acceleration Uploading Data to BOS
    • HTTPS Transmission Encryption Practice
    • Using CDN to Accelerate BOS
    • Hotlink Protection
    • AWS Lambda Synchronizing S3 Data to BOS
    • Impala Practice Based on BOS
    • Direct Upload of Web Data to BOS
      • Advanced Chapter I - STS Temporary Authentication
      • Basic Chapter - Directly Uploading Files to BOS in the Browser
      • Advanced Chapter II - Handling Older Versions of IE via the PostObject Interface
      • Principle Chapter III - STS Temporary Authentication
      • Principle Chapter I - Directly Uploading Files to BOS in the Browser
      • Principle Chapter II - Upload large file in parts
    • Data Migration
      • Migrating Data from Third-Party Clouds to BOS
      • Migrating Local Data to BOS
      • Scenario overview
    • Mobile Photo Editing App Practice
      • Overview and Scenario Introduction
      • Code example
      • Solution Practice - Building the Photo Editing App
      • Solution Practice - Using the Photo Editing App
    • Accessing BOS via Python API Request
      • Upload File to Bucket via PUT Request
      • Basics (Must-Read) - Generation of authentication string
      • Download Bucket File to Local via GET Request
  • FAQs
    • Certification and permission management
    • Image Service
    • Security Problems
    • Bucket Domain Name Request Style
    • General Problems
    • Object upload-download and management
    • Data Migration and Backup
    • Billing Problems
    • API & SDK & Tools
    • Common Questions Overview
    • Bucket access and management
    • Analysis and Statistic
    • Performance-related questions
  • Video Zone
    • Accessing BOS Resources via Domain Name
    • Object upload
    • Understanding BOS
    • BOS Tiered Storage
  • Quick Start
    • Create bucket
    • Get Object
    • Upload Object
    • Quick Start Guide
    • Getting Started with BOS
    • Delete Object
    • Delete bucket
  • Product pricing
    • Billing Cases
    • Insufficient Balance and Debt Reminder
    • View Consumption Details
    • Billing FAQs
    • Product price
      • Resource Package Price List
      • Pay-As-You-Go Charge Type
      • Pay-As-You-Go Price List
        • Traffic Price
        • Storage prices
        • Data Processing Price
        • Request Price
      • Resource Package Charge Type
        • Resource Package Deduction Rules
        • Resource Package Overview
      • Resource Package Price List - Deprecated
        • Internet downlink traffic package
        • Infrequent access storage package
        • Back-to-origin traffic package
        • Archive storage package
        • Cold storage package
        • Standard storage package
    • Charge Item Introduction
      • Traffic fees
      • Storage Cost
      • Request fees
      • Data processing fees
      • Charge Item Overview
  • SDK
    • SDK Overview
    • Harmony-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Log
      • Bucket management
        • Create Bucket
        • Bucket permission control
        • View the region to which a bucket belongs
        • Bucket Storage Class Setting and Query
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • Object management
        • Object permission control
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • Ruby-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Bucket management
        • Create Bucket
        • List buckets
        • Overview
        • Bucket permission management
        • View the region to which a bucket belongs
        • Check if bucket exists
        • Delete bucket
      • File management
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Copy Object
        • Download file
        • Upload files
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
    • Python-SDK
      • Overview
      • Version Change Records
      • Initialization
      • FAQs
      • Install the SDK Package
      • Exception handling
      • Log Control
      • Bucket management
        • Bucket cross-origin resource access
        • Create Bucket
        • Bucket Recycle Bin
        • List buckets
        • Overview
        • Bucket Inventory Management
        • Mirror back-to-origin
        • Bucket Lifecycle Management
        • Event notification
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • Close Recycle Bin
        • Logging
        • Data synchronization
        • Get Recycle Bin Activation Information
        • Check if bucket exists
        • User Credit Quota Management
        • Original image protection
        • Delete bucket
      • File management
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Copy Object
        • Select file
        • Soft links
        • Download file
        • Upload files
        • Restore archived storage class files
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
    • JavaScript-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Quota management
      • Bucket management
      • Install SDK
      • Bucket management
        • Data Synchronization Configuration
        • Create Bucket
        • Overview
        • Bucket Logging Management
        • Bucket Lifecycle Management
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • Object management
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Get File URL
        • Delete Object
    • Android-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Log
      • Object management
      • Bucket management
        • Create Bucket
        • Bucket permission control
        • View bucket list
        • Check if bucket exists
        • Delete bucket
      • File management
        • Object permission control
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • Java-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • FAQs
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Data Processing and Usage
      • Bucket management
      • Bucket management
        • Bucket static website hosting
        • Recycle bin
        • Bucket data synchronization
        • Create Bucket
        • List buckets
        • Overview
        • Mirror back-to-origin
        • Set Bucket server-side encryption
        • Set bucket storage class
        • Bucket permission management
        • View the region to which a bucket belongs
        • Tag Management
        • Check if bucket exists
        • Original image protection
        • Delete bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Get directory capacity overview
        • Select file
        • Download file
        • Upload files
        • Restore archived storage class files
        • List files in the storage space
        • Object Tag
        • Get and update file meta information
        • Check if a file exists
    • IOS-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Log
      • Object management
      • Bucket management
        • Create New Bucket
        • Determine whether the bucket exists and whether there is permission to access it
        • Bucket permission control
        • View bucket list
        • Delete bucket
      • File management
        • Multipart upload of objects
        • Get Object
        • View the object in the bucket
        • Copy Object
        • Upload Object
        • Delete Object
    • GO-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • Install the SDK Package
      • SDK Logging
      • Data Processing and Usage
      • Bucket management
      • Request management
      • Error handling
    • C-Dotnet-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • Exception handling
      • Bucket management
      • Object management
    • PHP-SDK
      • Overview
      • Version Change Records
      • Initialization
      • File management
      • Install the SDK Package
      • Exception handling
      • Bucket management
    • C-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Exception handling
      • Install SDK Toolkit
      • Bucket management
        • Create Bucket
        • List Buckets
        • Overview
        • Check If Bucket Exists
        • Delete Bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Delete file
        • Download file
        • Upload files
        • Archive storage
        • Get and Update Metadata Information
        • Get File Download Link
        • List files in the storage space
        • Check if a file exists
    • C++-SDK
      • Overview
      • Version Change Records
      • Initialization
      • Install the SDK Package
      • SDK Logging
      • Exception handling
      • Bucket management
        • Create Bucket
        • List buckets
        • Overview
        • Bucket permission management
        • View the region to which a bucket belongs
        • Check if bucket exists
        • Delete bucket
      • File management
        • Copy files
        • Object permission control
        • Change file storage class
        • Get file download URL
        • Delete file
        • Object Tag Management
        • Download file
        • Upload files
        • Archive storage
        • List files in the storage space
        • Get and update file meta information
        • Check if a file exists
      • Request management
        • Cancel request interruption
  • Product Description
    • Product functions
    • Application scenarios
    • Product advantages
    • Usage restrictions
    • Product introduction
    • Core concepts
    • Tiered Storage Introduction
      • Why Tiered Storage Exists
      • Introduction to storage classes
  • Data Cube
    • Batch processing
    • ZIP packaging and compression
    • Intelligent Data Processing
      • Video processing
        • Video frame capture
        • Instant video transcoding
        • Multimedia cloud processing
        • M3U8 signature
        • Get video metadata
      • Document processing
        • Document preview
      • Image processing
        • Image Processing Introduction
        • Image Processing FAQs
        • Image Processing Terminology Explanation
        • General Image Settings
          • Original image protection
        • Image Processing Guide V2_0
          • Removing Metadata
          • Image Scaling
          • Image Processing Persistence
          • Image Brightness
          • Image Blind Watermark
          • Return Original Image on Failure
          • Getting Image Information
          • Image Blur
          • Usage rules
          • Quality Transformation
          • Format conversion
          • Progressive Display
          • Image Sharpening
          • Grayscale Transformation
          • Image Compression
          • Image Anomaly Detection
          • Image Contrast
          • Image Rotation
            • Normal Rotation
            • Adaptive Rotation
          • Intelligent Processing
            • Intelligent Processing Usage Rules
            • Intelligent Scenarios
              • Lossless magnification
              • Portrait Cartoonization
              • Sky Segmentation
              • Style conversion
              • Black and white coloring
              • Stretch Restoration
              • Object erasure
            • Intelligent Effects
              • Intelligent Contrast
              • Intelligent Sharpness
              • Intelligent defogging
              • Intelligent Color Grading
          • Image Cropping
            • Rounded-corner rectangle cropping
            • Incircle Crop
            • Normal Crop
            • Index Crop
          • Image Watermark
            • Add Image-Text Mixed Watermark
            • Add Text Watermark
            • Add image watermark
        • Image Processing Guide V1_0
          • Image Cropping
          • Getting Image Information
          • Image Thumbnailing
          • Usage rules
          • Quality Transformation
          • Format conversion
          • Watermark
          • Progressive Display
          • Image Rotation
  • Related Agreements
    • Baidu AI Cloud Object Storage (BOS) and Baidu Netdisk Integration Usage Agreement
  • Developer Guide
    • Single-link rate limit
    • Image audit
    • Region and Endpoint
    • Event notification
    • Monitor Service Operations
    • Static website hosting
    • Basic concepts
    • Development Preparation
    • Data Publishing
      • Binding Custom Domain Name
      • CDN Acceleration Publishing
    • Data Disaster Recovery
      • Multi-AZ storage
      • Data synchronization
    • Data Security
      • Set anti-stealing-link
      • Set bucket trash
      • Set server-side encryption
      • Principle of least privilege
      • Permission control
        • Object permission control
        • Bucket permission control
        • IAM primary-IAM user access control
      • Versioning
        • Deletion Mark
        • Versioning Overview
    • Bucket Basic Operations
      • Create bucket
      • Data Publishing
      • Obtaining Bucket Region Information
      • Managing Lifecycle
      • Set access logs
      • Setting Bucket Tag
      • Setting Cross-Origin Resource Sharing (CORS)
      • View bucket list
      • Delete bucket
    • Data lifecycle management
      • Intelligent Business Analysis
    • Data Migration to Cloud
      • Migration from other clouds
      • Local data to cloud
      • Scenario overview
    • Data lake access
      • Hierarchical namespace
      • Metadata Conversion Service
    • Object Basic Operations
      • Managing Files
        • Copy data
        • Select scanning
        • Delete data
        • Obtaining Data Metadata
        • Viewing File List
        • Object Tag
      • Uploading Data
        • Simple upload
        • Append upload
        • Form upload
        • Upload callback
        • Chunking and Resumable Upload
      • Downloading Data
        • Simple Download
        • Resumable download
  • Data Lake Storage
    • Big Data Component Usage Guide
      • HBase Uses BOS as Underlying Storage
      • Kafka Data Storage to BOS
      • Hive Usage Guide
      • Presto Usage Guide
      • Spark Usage Guide
      • Flume Data Storage to BOS
      • Flink Usage Guide
      • Impala Usage Guide
      • Fluentd Collects Data Storage to BOS
      • Logstash Data Storage to BOS
      • Elasticsearch Snapshot Data Storage to BOS
      • Druid Uses BOS as Deep Storage
    • BOS HDFS tool
      • Overview
      • FAQs
      • Configuration and Usage
    • Data Migration and Transfer
      • Migrate Data to Hierarchical Namespace Bucket Using DistCp
      • DataX Read and Write BOS
    • Hierarchical namespace
      • Usage method
      • Service Introduction
      • Convert Normal Bucket to Hierarchical Namespace Bucket
      • Function Support Description
  • Document center
  • arrow
  • BOS
  • arrow
  • SDK
  • arrow
  • IOS-SDK
  • arrow
  • Object management
Table of contents on this page
  • Upload Object
  • Simplest upload
  • Set object's HTTP Header
  • User-defined metadata
  • View the object in the bucket.
  • Simple query
  • Extended query
  • Query simulated folders
  • Get Object
  • Simple object get
  • Download part of the content of an object
  • Download object to a specified path
  • Obtain the storageClass of an object
  • Obtain only ObjectMetadata
  • Get object URL
  • Delete Object
  • Copy Object
  • Multipart upload of objects
  • Complete Multipart Upload in parts
  • Cancel multipart upload
  • Retrieve unfinished multipart uploads
  • Get all uploaded part information

Object management

Updated at:2025-11-03

Upload Object

Simplest upload

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Use the BOSClient putObject method to upload objects either as files or binary strings.
    3. For the returned instance of type BOSPutObjectResponse, you can retrieve the eTag.
  • Example code

    Swift
    1BOSObjectContent* content = [[BOSObjectContent alloc] init];
    2// In file mode
    3content.objectData.file = @"<file path>";
    4// Or in binary data mode
    5NSData* data = [[NSData alloc] init];
    6content.objectData.data = data;
    7BOSPutObjectRequest* request = [[BOSPutObjectRequest alloc] init];
    8request.bucket = @"<bucketname>";
    9request.key = @"<objectname>";
    10request.objectContent = content;
    11__block BOSPutObjectResponse* response = nil;
    12BCETask* task = [client putObject:request];
    13task.then(^(BCEOutput* output) {
    14  if (output.progress) {
    15      NSLog(@"put object progress is %@", output.progress);
    16  }
    17  if (output.response) {
    18      response = (BOSPutObjectResponse*)output.response;
    19      NSLog(@"put object success!");
    20  }
    21  if (output.error) {
    22      NSLog(@"put object failure");
    23  }
    24});
    25[task waitUtilFinished];
    Plain Text
    1> **Note**: Objects are uploaded to BOS as files, and the putObject function supports uploading objects with a size not exceeding 5GB. After the putObject request is processed successfully, BOS will return the ETag of the object in the Header as the file identifier.
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4// Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSObjectContent* content = [[BOSObjectContent alloc] init];
    12// In file mode
    13    content.objectData.file = @"<file path>";
    14// Or in binary data mode
    15    NSData* data = [[NSData alloc] init];
    16    content.objectData.data = data;
    17    BOSPutObjectRequest* request = [[BOSPutObjectRequest alloc] init];
    18    request.bucket = @"<bucketname>";
    19    request.key = @"<objectname>";
    20    request.objectContent = content;
    21    __block BOSPutObjectResponse* response = nil;
    22    BCETask* task = [client putObject:request];
    23    task.then(^(BCEOutput* output) {
    24        if (output.progress) {
    25            NSLog(@"put object progress is %@", output.progress);
    26        }
    27        if (output.response) {
    28            response = (BOSPutObjectResponse*)output.response;
    29            NSLog(@"put object success!");
    30        }
    31        if (output.error) {
    32            NSLog(@"put object failure");
    33        }
    34    });
    35    [task waitUtilFinished];
    36}

Set object's HTTP Header

BOS allows setting Http Headers when uploading an object.

  • Basic workflow

    1. Create a BOSObjectMetadata class instance.
    2. Set fields like contentEncoding, contentType, and contentDisposition in the BOSObjectMetadata instance.
    3. Assign the BOSObjectMetadata instance to the objectContent.metadata field of the BOSPutObjectRequest.
  • Example code

    Swift
    1BOSObjectMetadata* metadata = [[BOSObjectMetadata alloc] init];
    2metadata.contentEncoding = @"<encoding>";
    3metadata.contentDisposition = @"<content disposition>";
    4content.metadata = metadata;
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4// Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSObjectContent* content = [[BOSObjectContent alloc] init];
    12// In file mode
    13    content.objectData.file = @"<file path>";
    14// Or in binary data mode
    15    NSData* data = [[NSData alloc] init];
    16    content.objectData.data = data;
    17    BOSObjectMetadata* metadata = [[BOSObjectMetadata alloc] init];
    18    metadata.contentEncoding = @"<encoding>";
    19    metadata.contentDisposition = @"<content disposition>";
    20    content.metadata = metadata;
    21    BOSPutObjectRequest* request = [[BOSPutObjectRequest alloc] init];
    22    request.bucket = @"<bucketname>";
    23    request.key = @"<Objectname>";
    24    request.objectContent = content;
    25    __block BOSPutObjectResponse* response = nil;
    26    BCETask* task = [client putObject:request];
    27    task.then(^(BCEOutput* output) {
    28        if (output.progress) {
    29            NSLog(@"put object progress is %@", output.progress);
    30        }
    31        if (output.response) {
    32            response = (BOSPutObjectResponse*)output.response;
    33            NSLog(@"put object success!");
    34        }
    35        if (output.error) {
    36            NSLog(@"put object failure");
    37        }
    38    });
    39    [task waitUtilFinished];
    40}

User-defined metadata

BOS supports user-defined metadata for object descriptions.

  • Basic workflow

    1. Create a BOSObjectMetadata class instance.
    2. Assign a custom metadata dictionary to the userMetadata field of the BOSObjectMetadata.
  • Example code

    Swift
    1BOSObjectMetadata* metadata = [[BOSObjectMetadata alloc] init];
    2metadata.contentEncoding = @"<encoding>";
    3metadata.contentDisposition = @"<content disposition>";
    4content.metadata = metadata;
    5NSDictionary* customMetadata = @{
    6  @"name" : @"my-data"
    7};
    8content.metadata.userMetadata = customMetadata;
    Plain Text
    1> **Note:** In the provided example, a user-defined metadata property is created with the key "name" and the value "my-data." This metadata can be retrieved when the object is downloaded. Though multiple such parameters can be added, the combined size of all User Metadata must not exceed 2KB.  
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4// Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSObjectContent* content = [[BOSObjectContent alloc] init];
    12// In file mode
    13    content.objectData.file = @"<file path>";
    14// Or in binary data mode
    15    NSData* data = [[NSData alloc] init];
    16    content.objectData.data = data;
    17    BOSObjectMetadata* metadata = [[BOSObjectMetadata alloc] init];
    18    metadata.contentEncoding = @"<encoding>";
    19    metadata.contentDisposition = @"<content disposition>";
    20    content.metadata = metadata;
    21    NSDictionary* customMetadata = @{
    22        @"name" : @"my-data"
    23    };
    24    content.metadata.userMetadata = customMetadata;
    25    BOSPutObjectRequest* request = [[BOSPutObjectRequest alloc] init];
    26    request.bucket = @"<bucketname>";
    27    request.key = @"<objectname>";
    28    request.objectContent = content;
    29    __block BOSPutObjectResponse* response = nil;
    30    BCETask* task = [client putObject:request];
    31    task.then(^(BCEOutput* output) {
    32        if (output.progress) {
    33            NSLog(@"put object progress is %@", output.progress);
    34        }
    35        if (output.response) {
    36            response = (BOSPutObjectResponse*)output.response;
    37            NSLog(@"put object success!");
    38        }
    39        if (output.error) {
    40            NSLog(@"put object failure");
    41        }
    42    });
    43    [task waitUtilFinished];
    44}

View the object in the bucket.

Simple query

View the list of objects in a bucket.

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Executing the BOSClient listObjects method will return an instance of the BOSListObjectsResponse class.
    3. You can iterate through the contents field of the BOSListObjectsResponse type to retrieve keys, lastModified dates, eTags, sizes, and owners.
  • Example code

    Swift
    1BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
    2listObjRequest.bucket = @"<bucketname>";
    3__block BOSListObjectsResponse* listObjResponse = nil;
    4BCETask* task = [client listObjects:listObjRequest];
    5task.then(^(BCEOutput* output) {
    6  if (output.response) {
    7      listObjResponse = (BOSListObjectsResponse*)output.response;
    8      for (BOSObjectInfo* object in listObjResponse.contents) {
    9          NSLog(@"the object key is %@", object.key);
    10          NSLog(@"the object lastModified is %@", object.lastModified);
    11          NSLog(@"the object eTag is %@", object.eTag);
    12          NSLog(@"the object size is %llu", object.size);
    13          NSLog(@"the object owner id is %@", object.owner.ownerID);
    14      }
    15  }
    16  if (output.error) {
    17      NSLog(@"list objects failure");
    18  }
    19});
    20[task waitUtilFinished];
    Plain Text
    1> **Note:** The listObjects method returns a BOSListObjectsResponse object, which contains the results of this listObject request. Users can obtain the description information of all objects through the contents attribute in BOSListObjectsResponse.
    2>
    3> -   By default, if the number of objects in a bucket exceeds 1,000, only 1,000 objects will be returned. The isTruncated value in the result will be YES, and nextMarker will indicate the starting point for the next query.  
    4> -   To retrieve more objects, use the marker parameter for reading in batches. Refer to [Extended Query](#Extended query).
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
    12    listObjRequest.bucket = @"<bucketname>";
    13    __block BOSListObjectsResponse* listObjResponse = nil;
    14    BCETask* task = [client listObjects:listObjRequest];
    15    task.then(^(BCEOutput* output) {
    16        if (output.response) {
    17            listObjResponse = (BOSListObjectsResponse*)output.response;
    18            for (BOSObjectInfo* object in listObjResponse.contents) {
    19                NSLog(@"the object key is %@", object.key);
    20                NSLog(@"the object lastModified is %@", object.lastModified);
    21                NSLog(@"the object eTag is %@", object.eTag);
    22                NSLog(@"the object size is %llu", object.size);
    23                NSLog(@"the object owner id is %@", object.owner.ownerID);
    24            }
    25        }
    26        if (output.error) {
    27            NSLog(@"list objects failure");
    28        }
    29    });
    30    [task waitUtilFinished];
    31}

Extended query

Users can configure BOSListObjectsRequest parameters to enable additional query operations. The available extended parameters in BOSListObjectsRequest include:

Parameter name Description Default value
maxKeys Specify the maximum number of objects to return, which must not exceed 1,000. 1000
prefix Set the prefix of the objectKey. The prefix means that the objectKey contains and starts with the value of prefix. It is usually used in conjunction with delimiter when [querying simulated folders](#Query simulated folders). -
delimiter It is a delimiter used to hierarchize objectKey. It is usually used in conjunction with prefix when [querying simulated folders](#Query simulated folders). The objectKey from the prefix to the first occurrence of the delimiter character is called: commonPrefixes. -
marker This is a string that specifies the starting position of the returned results. When the marker value is set, objects will be listed starting from this value in alphabetical order. -
  • Basic workflow

    1. Create a BOSListObjectsRequest class instance.
    2. Configure fields like delimiter, marker, prefix, and maxKeys in the BOSListObjectsRequest to enable extended query operations.
    3. Create a BOSClient instance and execute the listObjects method.
  • Example code

    Swift
    1BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
    2listObjRequest.bucket = @"<bucketname>";
    3listObjRequest.marker = @"<marker>";
    4__block BOSListObjectsResponse* listObjResponse = nil;
    5BCETask* task = [client listObjects:listObjRequest];
    6task.then(^(BCEOutput* output) {
    7  if (output.response) {
    8      listObjResponse = (BOSListObjectsResponse*)output.response;
    9      for (BOSObjectInfo* object in listObjResponse.contents) {
    10          NSLog(@"the object key is %@", object.key);
    11          NSLog(@"the object lastModified is %@", object.lastModified);
    12          NSLog(@"the object eTag is %@", object.eTag);
    13          NSLog(@"the object size is %llu", object.size);
    14          NSLog(@"the object owner id is %@", object.owner.ownerID);
    15      }
    16  }
    17  if (output.error) {
    18      NSLog(@"list objects failure");
    19  }
    20});
    21[task waitUtilFinished];
  • Complete example

    Example 1:

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
    12    listObjRequest.bucket = @"<bucketname>";
    13    listObjRequest.marker = @"<marker>";
    14    __block BOSListObjectsResponse* listObjResponse = nil;
    15    BCETask* task = [client listObjects:listObjRequest];
    16    task.then(^(BCEOutput* output) {
    17        if (output.response) {
    18            listObjResponse = (BOSListObjectsResponse*)output.response;
    19            for (BOSObjectInfo* object in listObjResponse.contents) {
    20                NSLog(@"the object key is %@", object.key);
    21                NSLog(@"the object lastModified is %@", object.lastModified);
    22                NSLog(@"the object eTag is %@", object.eTag);
    23                NSLog(@"the object size is %llu", object.size);
    24                NSLog(@"the object owner id is %@", object.owner.ownerID);
    25            }
    26        }
    27        if (output.error) {
    28            NSLog(@"list objects failure");
    29        }
    30    });
    31    [task waitUtilFinished];
    32}

    Example II: A complete example using nextMarker.

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
    12    listObjRequest.bucket = @"<bucketname>";
    13    listObjRequest.marker = @"<marker>";
    14    __block BOSListObjectsResponse* listObjResponse = nil;
    15    BCETask* task = [client listObjects:listObjRequest];
    16    task.then(^(BCEOutput* output) {
    17        if (output.response) {
    18            listObjResponse = (BOSListObjectsResponse*)output.response;
    19        }
    20        if (output.error) {
    21            NSLog(@"list objects failure");
    22        }
    23    });
    24    [task waitUtilFinished];
    25    if (listObjResponse != nil) {
    26        listObjRequest.marker = listObjResponse.nextMarker;
    27        task = [client listObjects:listObjRequest];
    28        task.then(^(BCEOutput* output) {
    29            if (output.response) {
    30                listObjResponse = (BOSListObjectsResponse*)output.response;
    31                for (BOSObjectInfo* object in listObjResponse.contents) {
    32                    NSLog(@"the object key is %@", object.key);
    33                    NSLog(@"the object lastModified is %@", object.lastModified);
    34                    NSLog(@"the object eTag is %@", object.eTag);
    35                    NSLog(@"the object size is %llu", object.size);
    36                    NSLog(@"the object owner id is %@", object.owner.ownerID);
    37                }
    38            }
    39        });
    40    }
    41}

Query simulated folders

Since BOS is inherently a (<Key>,<Value>) storage system, the concept of "folder" does not exist in principle. However, you can simulate the folder function by combining the delimiter and prefix} parameters.

Suppose the bucket contains five files: bos.jpg, fun/, fun/test.jpg, fun/movie/001.avi, and fun/movie/007.avi. The "/" symbol can be used as a delimiter to mimic folder structures.

Recursively list all files under the simulated folder

You can obtain all files under a simulated folder by setting the prefix parameter:

Swift
1BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
2listObjRequest.bucket = @"<bucketname>";
3 listObjRequest.prefix = @"fun/";
4__block BOSListObjectsResponse* listObjResponse = nil;
5BCETask* task = [client listObjects:listObjRequest];
6task.then(^(BCEOutput* output) {
7    if (output.response) {
8        listObjResponse = (BOSListObjectsResponse*)output.response;
9        for (BOSObjectInfo* object in listObjResponse.contents) {
10            NSLog(@"%@", object.key);
11        }
12    }
13});
14[task waitUtilFinished];

Output:

Swift
1Objects:
2fun/
3fun/movie/001.avi
4fun/movie/007.avi
5fun/test.jpg

View files and subfolders under the simulated folder

With the combination of prefix and delimiter, it can list files and subfolders under the simulated folder:

Swift
1BOSListObjectsRequest* listObjRequest = [[BOSListObjectsRequest alloc] init];
2listObjRequest.bucket = @"<bucketname>";
3// Specify "/" as the delimiter for simulated folder
4listObjRequest.delimiter = @"/";
5// List all files and subfolders under the fun folder
6listObjRequest.prefix = @"fun/";
7__block BOSListObjectsResponse* listObjResponse = nil;
8BCETask* task = [client listObjects:listObjRequest];
9task.then(^(BCEOutput* output) {
10    if (output.response) {
11        listObjResponse = (BOSListObjectsResponse*)output.response;
12    }
13    if (output.error) {
14        NSLog(@"list objects failure");
15    }
16});
17[task waitUtilFinished];
18// Traverse all objects
19NSLog(@"Objects:");
20for (BOSObjectInfo* object in listObjResponse.contents) {
21    NSLog(@"%@", object.key);
22}
23// Traverse all CommonPrefixes
24NSLog(@"CommonPrefixs:");
25for (NSString* commonPrefix in listObjResponse.commonPrefixes) {
26    NSLog(@"%@", commonPrefix);
27}

Output:

Swift
1Objects:
2fun/
3fun/test.jpg
4CommonPrefixs:
5fun/movie/

Note: In the returned results, the list of contents shows the files under the “fun” folder. The list in commonPrefixs shows all subfolders under the fun folder. It can be seen that the two files fun/movie/001.avi and fun/movie/007.avi are not listed because they belong to the movie subfolder under the fun folder.

Get Object

Simple object get

You can load the object into memory using the provided code.

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Executing the BOSClient getObject method will return a BOSGetObjectResponse instance.
    3. Access the objectContent.objectData.data property of the BOSGetObjectResponse instance to retrieve the data.
  • Example code

    Swift
    1__block BOSGetObjectResponse* getObjResponse = nil;
    2BOSGetObjectRequest* getObjRequest = [[BOSGetObjectRequest alloc] init];
    3getObjRequest.bucket = @"<bucketname>";
    4getObjRequest.key = @"<objectname>";
    5BCETask* task = [client getObject:getObjRequest];
    6task.then(^(BCEOutput* output) {
    7  if (output.response) {
    8      getObjResponse = (BOSGetObjectResponse*)output.response;
    9      NSLog(@"get object success!");
    10  }
    11  if (output.error) {
    12      NSLog(@"get object failure with %@", outpu****t.error);
    13  }
    14  if (output.progress) {
    15      NSLog(@"the get object progress is %@", output.progress);
    16  }
    17});
    18[task waitUtilFinished];
    19// Retrieve data from memory
    20NSData* data = getObjResponse.objectContent.objectData.data;
    Plain Text
    1> **Note:**
    2>
    3> -   `BOSObjectContent` contains detailed information about the object, including its bucket location, object name, metadata, and data storage.  
    4> -   `BOSObjectMetadata` includes the ETag set during the object upload, HTTP headers, and custom metadata.  
    5> -   Retrieve the object's data through the `objectData` property of `BOSObjectContent`.  
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    __block BOSGetObjectResponse* getObjResponse = nil;
    12    BOSGetObjectRequest* getObjRequest = [[BOSGetObjectRequest alloc] init];
    13    getObjRequest.bucket = @"<bucketname>";
    14    getObjRequest.key = @"<objectname>";
    15    BCETask* task = [client getObject:getObjRequest];
    16    task.then(^(BCEOutput* output) {
    17        if (output.response) {
    18            getObjResponse = (BOSGetObjectResponse*)output.response;
    19            NSLog(@"get object success!");
    20        }
    21        if (output.error) {
    22            NSLog(@"get object failure with %@", output.error);
    23        }
    24        if (output.progress) {
    25            NSLog(@"the get object progress is %@", output.progress);
    26        }
    27    });
    28    [task waitUtilFinished];
    29    NSData* data = getObjResponse.objectContent.objectData.data;
    30}

Download part of the content of an object

  • Basic workflow

    1. Instantiate the BOSGetObjectRequest class.
    2. Specify the rangeStart and/or rangeEnd fields in the BOSGetObjectRequest instance.
    3. Perform the client.getObject operation.
  • Example code

    Swift
    1__block BOSGetObjectResponse* getObjResponse = nil;
    2BOSGetObjectRequest* getObjRequest = [[BOSGetObjectRequest alloc] init];
    3getObjRequest.bucket = @"<bucketname>";
    4getObjRequest.key = @"<objectname>";
    5// Retrieve the first 100 bytes
    6getObjRequest.rangeStart = @"0";
    7getObjRequest.rangeEnd = @"99";
    8BCETask* task = [client getObject:getObjRequest];
    9task.then(^(BCEOutput* output) {
    10    if (output.response) {
    11        getObjResponse = (BOSGetObjectResponse*)output.response;
    12        NSLog(@"get object success!");
    13    }
    14    if (output.error) {
    15        NSLog(@"get object failure with %@", output.error);
    16    }
    17    if (output.progress) {
    18        NSLog(@"the get object progress is %@", output.progress);
    19    }
    20});
    21[task waitUtilFinished];
    22NSData* data = getObjResponse.objectContent.objectData.data;
    Plain Text
    1> **Note:** Users can leverage this function for segmented downloads and resumable file uploads.  

Download object to a specified path

Users can use the following code to directly download an object to a specified path.

  • Basic workflow

    1. Instantiate the BOSGetObjectRequest class.
    2. Specify the filename to be saved in the file field of the BOSGetObjectRequest instance.
    3. Perform the client.getObject operation.
    4. Download an object directly to a specified path.
  • Example code

    Swift
    1__block BOSGetObjectResponse* getObjResponse = nil;
    2BOSGetObjectRequest* getObjRequest = [[BOSGetObjectRequest alloc] init];
    3getObjRequest.bucket = @"<bucketname>";
    4getObjRequest.key = @"<objectname>";
    5// Set the file path for saving
    6getObjRequest.file = @"<file>";
    7BCETask* task = [client getObject:getObjRequest];
    8task.then(^(BCEOutput* output) {
    9    if (output.response) {
    10        getObjResponse = (BOSGetObjectResponse*)output.response;
    11        NSLog(@"get object success!");
    12    }
    13    if (output.error) {
    14        NSLog(@"get object failure with %@", output.error);
    15    }
    16    if (output.progress) {
    17        NSLog(@"the get object progress is %@", output.progress);
    18    }
    19});
    20[task waitUtilFinished];

Obtain the storageClass of an object

The storage class of an object is categorized into STANDARD (standard storage), STANDARD_IA (infrequent access storage), and COLD (cold storage).

Example code

Swift
1__block BOSGetObjectMetadataResponse* getObjMetaResponse = nil;
2BCETask* task = [client getObjectMetadata:@"<bucketname>" objectKey:@"<objectname>"];
3task.then(^(BCEOutput* output) {
4    if (output.response) {
5        getObjMetaResponse = (BOSGetObjectMetadataResponse*)output.response;
6        NSString storageClass = getObjMetaResponse.storageClass;
7        NSLog(@"get object storageClass success!");
8    }
9    if (output.error) {
10        NSLog(@"get object storageClass failure");
11    }
12});
13[task waitUtilFinished];

Obtain only ObjectMetadata

Use the getObjectMetadata method to retrieve only the object's metadata without including its content.

  • Example code

    Swift
    1__block BOSGetObjectMetadataResponse* getObjMetaResponse = nil;
    2BCETask* task = [client getObjectMetadata:@"<bucketname>" objectKey:@"<objectname>"];
    3task.then(^(BCEOutput* output) {
    4    if (output.response) {
    5        getObjMetaResponse = (BOSGetObjectMetadataResponse*)output.response;
    6        NSLog(@"get object metadata success!");
    7    }
    8    if (output.error) {
    9        NSLog(@"get object metadata failure");
    10    }
    11});
    12[task waitUtilFinished];

Get object URL

The following code allows you to get the URL of a specific object, which is commonly used for temporarily sharing the object's URL with others.

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Execute the BOSClient.generatePresignedUrl method.
    3. The method returns the URL of the object.
  • Example code

    Swift
    1__block BOSGeneratePresignedUrlResponse *generateObjetUrlRes = nil;
    2  BCEOutput_ output = [client generatePresignedUrl:@"<bucketname>" objectKey:@"<objectname>" expirationInSeconds:<ExpirationInSeconds>];
    3  if (output.response) {
    4      generateObjetUrlRes = (BOSGeneratePresignedUrlResponse_)output.response;
    5      NSLog(@"get url success, the usrlstting is : %@", [generateObjetUrlRes.objectUrl absoluteString]);
    6  }
    7  if (output.error) {
    8      NSLog(@"get url failure, error : %@:", output.error);
    9  }

Note: ExpirationInSeconds is the specified URL validity period, calculated from the current time. It is an optional parameter, and the system default value is 1,800 seconds if not configured. To set a permanent non-expiration time, the ExpirationInSeconds parameter can be set to -1. You cannot set it to any other negative value.

  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    __block BOSGeneratePresignedUrlResponse *generateObjetUrlRes = nil;
    12      BCEOutput* output = [client generatePresignedUrl:@"<bucketname>" objectKey:@"<objectname>" expirationInSeconds:<ExpirationInSeconds>];
    13    if (output.response) {
    14    generateObjetUrlRes = 	(BOSGeneratePresignedUrlResponse*)output.response;
    15    NSLog(@"get url success, the usrlstting is : %@", [generateObjetUrlRes.objectUrl absoluteString]);
    16    }
    17    if (output.error) {
    18    NSLog(@"get url failure, error : %@:", output.error);
    19    }
    20}

Delete Object

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Call the eTag or lastModified method.
    3. Handle errors that arise after an operation fails.
  • Example code

    Swift
    1__block BOSDeleteObjectResponse* response = nil;
    2BCETask* task = [client deleteObject:@"<bucketname>" objectKey:@"<objectname>"];
    3task.then(^(BCEOutput* output) {
    4    if (output.response) {
    5        response = (BOSDeleteObjectResponse*)output.response;
    6        NSLog(@"delete obj success!");
    7    }
    8    if (output.error) {
    9        NSLog(@"delete obj failure");
    10    }
    11});
    12[task waitUtilFinished];
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    __block BOSDeleteObjectResponse* response = nil;
    12    BCETask* task = [client deleteObject:@"<bucketname>" objectKey:@"<objectname>"];
    13    task.then(^(BCEOutput* output) {
    14      if (output.response) {
    15          response = (BOSDeleteObjectResponse*)output.response;
    16          NSLog(@"delete obj success!");
    17      }
    18      if (output.error) {
    19          NSLog(@"delete obj failure");
    20      }
    21    });
    22    [task waitUtilFinished];
    23}

Copy Object

Simply Copy Object

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Execute the BOSClient.copyObject method.
    3. Return a BOSCopyObjectResponse instance. The eTag and last modification timestamp can be accessed via eTag/lastModified, among other methods.
  • Example code

    Swift
    1BOSCopyObjectRequest* request = [[BOSCopyObjectRequest alloc] init];
    2request.bucket = @"<bucketname>";
    3request.key = @"<objectname>";
    4request.source = @"<sourceBucket>/<sourceObject";
    5__block BOSCopyObjectResponse* response = nil;
    6BCETask* task = [client copyObject:request];
    7task.then(^(BCEOutput* output) {
    8    if (output.response) {
    9        response = (BOSCopyObjectResponse*)output.response;
    10        NSLog(@"copy obj success!");
    11    }
    12    if (output.error) {
    13        NSLog(@"copy obj failure");
    14    }
    15});
    16[task waitUtilFinished];
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSCopyObjectRequest* request = [[BOSCopyObjectRequest alloc] init];
    12    request.bucket = @"<bucketname>";
    13    request.key = @"<objectname>";
    14    request.source = @"<sourceBucket>/<sourceObject";
    15    __block BOSCopyObjectResponse* response = nil;
    16    BCETask* task = [client copyObject:request];
    17    task.then(^(BCEOutput* output) {
    18      if (output.response) {
    19          response = (BOSCopyObjectResponse*)output.response;
    20          NSLog(@"copy obj success!");
    21      }
    22      if (output.error) {
    23          NSLog(@"copy obj failure");
    24      }
    25    });
    26    [task waitUtilFinished];
    27}
    Plain Text
    1> **Note:** The copyObject method returns a  `BOSCopyObjectResponse` object containing the new object's ETag and modification time.

Copy object with specified conditions

Copy an object with conditions specified. This functionality is typically applied in scenarios like:

  • Copy an object while resetting its metadata.
  • Resetting the metadata of an existing object by setting both the source and the target to the same object.
  • Copy when the eTag of the source object is the same as the specified eTag;
  • Copy when the eTag of the source object is the different from the specified eTag;
  • Copy when the source object has not been modified after the specified time;
  • Copy when the source object has been modified after the specified time;

Details as follows:

  • Basic workflow

    1. Create an instance of the BOSCopyObjectRequest class, and pass in the parameters <source>, <ifMatchEtag>, <ifNotMatchEtag>, <ifModifiedSince>, <ifUnmodifiedSince>, <metadataDirective>.
    2. Return a BOSCopyObjectResponse instance. The eTag and last modification timestamp can be accessed via eTag/lastModified, among other methods.
  • Example code

    Swift
    1BOSCopyObjectRequest* request = [[BOSCopyObjectRequest alloc] init];
    2request.bucket = @"<bucketname>";
    3request.key = @"<objectname>";
    4request.source = @"<sourceBucket>/<sourceObject";
    5request.metadataDirective = @"replace";
    6request.ifModifiedSince = @"Wed, 01 Mar 2006 12:00:00 GMT";
    7__block BOSCopyObjectResponse* response = nil;
    8BCETask* task = [client copyObject:request];
    9task.then(^(BCEOutput* output) {
    10  if (output.response) {
    11      response = (BOSCopyObjectResponse*)output.response;
    12      NSLog(@"copy obj success!");
    13  }
    14  if (output.error) {
    15      NSLog(@"copy obj failure");
    16  }
    17});
    18[task waitUtilFinished];
    Plain Text
    1> **Note:**`BOSCopyObjectRequest` allows users to modify the ObjectMeta of the target object and also provides the setting of the `MatchingETagConstraints` parameter.

Multipart upload of objects

In addition to using the putObject() method for file uploads to BOS, BOS also supports another upload mode called Multipart Upload. This mode can be used in scenarios such as:

  • When resumable uploads are required.
  • When uploading files larger than 5GB.
  • When the connection to the BOS server is frequently interrupted due to unstable network conditions.
  • Enable streaming file uploads.
  • The file size cannot be determined before uploading.

Complete Multipart Upload in parts

Suppose there is a file with the local path /path/to/file.zip. Since the file is large, multipart upload is used to transmit it to BOS.

  • Basic workflow

    1. Start a multipart upload.
    2. Upload individual parts.
    3. Finalize the multipart upload.

Initialize multipart upload

Use initiateMultipartUpload method to initialize a multipart upload event:

  • Example code

    Swift
    1BOSInitiateMultipartUploadRequest* initMPRequest = [[BOSInitiateMultipartUploadRequest alloc] init];
    2initMPRequest.bucket = @"<bucketname>";
    3initMPRequest.key = @"<objectname>";
    4initMPRequest.contentType = @"<content type>";
    5__block BOSInitiateMultipartUploadResponse* initMPResponse = nil;
    6BCETask* task = [client initiateMultipartUpload:initMPRequest];
    7task.then(^(BCEOutput* output) {
    8  if (output.response) {
    9      initMPResponse = (BOSInitiateMultipartUploadResponse*)output.response;
    10      NSLog(@"initiate multipart upload success!");
    11  }
    12  if (output.error) {
    13      NSLog(@"initiate multipart upload failure");
    14  }
    15});
    16[task waitUtilFinished];
    17NSString* uploadID = initMPResponse.uploadId;
    Plain Text
    1> **Note:**`The return result of initiateMultipartUpload` contains `UploadId`, which is the unique identifier for distinguishing multipart upload events, and we will use it in subsequent operations.

Upload parts

Upload the file in segments.

  • Example code

    Swift
    1// Calculate the count of parts
    2NSString* file = @"/path/to/file.zip";
    3NSDictionary<NSString*, id>* attr = [[NSFileManager defaultManager] attributesOfItemAtPath:file error:nil];
    4uint64_t fileSize = attr.fileSize;
    5uint64_t partSize = 1024 * 1024 * 5L;
    6uint64_t partCount = fileSize / partSize;
    7if (fileSize % partSize != 0) {
    8  ++partCount;
    9}
    10NSMutableArray<BOSPart*>* parts = [NSMutableArray array];
    11NSFileHandle* handle = [NSFileHandle fileHandleForReadingAtPath:@"/path/to/file.zip"];
    12for (uint64_t i = 0; i < partCount; ++i) {
    13  // seek
    14  uint64_t skip = partSize * i;
    15  [handle seekToFileOffset:skip];
    16  uint64_t size = (partSize < fileSize - skip) ? partSize : fileSize - skip;
    17  // data
    18  NSData* data = [handle readDataOfLength:size];
    19  // request
    20  BOSUploadPartRequest* uploadPartRequest = [[BOSUploadPartRequest alloc] init];
    21  uploadPartRequest.bucket = @"<bucketname>";
    22  uploadPartRequest.key = @"<objectname>";
    23  uploadPartRequest.objectData.data = data;
    24  uploadPartRequest.partNumber = i + 1;
    25  uploadPartRequest.uploadId = uploadID;
    26  __block BOSUploadPartResponse* uploadPartResponse = nil;
    27  task = [client uploadPart:uploadPartRequest];
    28  task.then(^(BCEOutput* output) {
    29      if (output.response) {
    30          uploadPartResponse = (BOSUploadPartResponse*)output.response;
    31          BOSPart* part = [[BOSPart alloc] init];
    32          part.partNumber = i + 1;
    33          part.eTag = uploadPartResponse.eTag;
    34                  [parts addObject:part];
    35      }
    36  });
    37  [task waitUtilFinished];
    38}
    Plain Text
    1> **Note:** The core of the above code is to call the `UploadPart` method to upload each part concurrently, but the following points should be noted:
    2>
    3> -   The `uploadPart` method mandates that the size of each part, except for the last one, must be at least 5 MB. However, this size requirement is only validated when the multipart upload is finalized, not during the `Upload Part` operation itself.
    4> -   To ensure no errors during network transmission, it is recommended to use the Content-MD5 value returned by BOS for each part after `uploadPart` to verify the correctness of the uploaded part data. When all part data is combined into one Object, it no longer contains the MD5 value.
    5> -   The part number must be within the range of 1 to 10,000. If this limit is exceeded, BOS will return an InvalidArgument error code.  
    6> -   For each uploaded part, the stream must be positioned at the beginning of the respective part.  
    7> -   After each Part upload, the return result of BOS will include a `BOSPart` object, which is a combination of the uploaded block's ETag and block number (PartNumber). It will be used in subsequent steps to complete the multipart upload, so it must be saved. Generally speaking, these `BOSPart` objects will be saved in an array.

Complete multipart upload

  • Example code

    Swift
    1BOSCompleteMultipartUploadRequest* compMultipartRequest = [[BOSCompleteMultipartUploadRequest alloc] init];
    2compMultipartRequest.bucket = @"<bucketname>";
    3compMultipartRequest.key = @"<objectname>";
    4compMultipartRequest.uploadId = uploadID;
    5compMultipartRequest.parts = parts;
    6__block BOSCompleteMultipartUploadResponse* complResponse = nil;
    7task = [client completeMultipartUpload:compMultipartRequest];
    8task.then(^(BCEOutput* output) {
    9  if (output.response) {
    10      complResponse = (BOSCompleteMultipartUploadResponse*)output.response;
    11      NSLog(@"complte multiparts success!");
    12  }
    13  if (output.error) {
    14      NSLog(@"complte multiparts failure %@", output.error);
    15  }
    16});
    17[task waitUtilFinished];
    Plain Text
    1> **Note:** The `parts` in the above code is the list of parts saved in the second step. After BOS receives the list of parts submitted by the user, it will verify the validity of each data Part one by one. Once all data parts are validated, BOS will assemble the data parts into a complete Object.
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4// Initialize
    5BCECredentials* credentials = [[BCECredentials alloc] init];
    6credentials.accessKey = @"<access key>";
    7credentials.secretKey = @"<secret key>";
    8BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9configuration.credentials = credentials;
    10BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11// Initialize multipart upload
    12BOSInitiateMultipartUploadRequest* initMPRequest = [[BOSInitiateMultipartUploadRequest alloc] init];
    13initMPRequest.bucket = @"<bucketname>";
    14initMPRequest.key = @"<objectname>";
    15initMPRequest.contentType = @"<content type>";
    16 __block BOSInitiateMultipartUploadResponse* initMPResponse = nil;
    17 BCETask* task = [client initiateMultipartUpload:initMPRequest];
    18 task.then(^(BCEOutput* output) {
    19     if (output.response) {
    20         initMPResponse = (BOSInitiateMultipartUploadResponse*)output.response;
    21         NSLog(@"initiate multipart upload success!");
    22     }
    23     if (output.error) {
    24         NSLog(@"initiate multipart upload failure");
    25     }
    26 });
    27 [task waitUtilFinished];
    28 NSString* uploadID = initMPResponse.uploadId;
    29// Calculate the count of parts
    30 NSString* file = @"/path/to/file.zip";
    31 NSDictionary<NSString*, id>* attr = [[NSFileManager defaultManager] attributesOfItemAtPath:file error:nil];
    32 uint64_t fileSize = attr.fileSize;
    33 uint64_t partSize = 1024 * 1024 * 5L;
    34 uint64_t partCount = fileSize / partSize;
    35 if (fileSize % partSize != 0) {
    36     ++partCount;
    37 }
    38 NSMutableArray<BOSPart*>* parts = [NSMutableArray array];
    39 NSFileHandle* handle = [NSFileHandle fileHandleForReadingAtPath:@"/path/to/file.zip"];
    40 for (uint64_t i = 0; i < partCount; ++i) {
    41     // seek
    42     uint64_t skip = partSize * i;
    43     [handle seekToFileOffset:skip];
    44     uint64_t size = (partSize < fileSize - skip) ? partSize : fileSize - skip;
    45     // data
    46     NSData* data = [handle readDataOfLength:size];
    47     // request
    48     BOSUploadPartRequest* uploadPartRequest = [[BOSUploadPartRequest alloc] init];
    49     uploadPartRequest.bucket = @"<bucketname>";
    50     uploadPartRequest.key = @"<objectname>";
    51     uploadPartRequest.objectData.data = data;
    52     uploadPartRequest.partNumber = i + 1;
    53     uploadPartRequest.uploadId = uploadID;
    54     __block BOSUploadPartResponse* uploadPartResponse = nil;
    55     task = [client uploadPart:uploadPartRequest];
    56     task.then(^(BCEOutput* output) {
    57         if (output.response) {
    58             uploadPartResponse = (BOSUploadPartResponse*)output.response;
    59             BOSPart* part = [[BOSPart alloc] init];
    60             part.partNumber = i + 1;
    61             part.eTag = uploadPartResponse.eTag;
    62                     [parts addObject:part];
    63         }
    64     });
    65     [task waitUtilFinished];
    66 }
    67 BOSCompleteMultipartUploadRequest* compMultipartRequest = [[BOSCompleteMultipartUploadRequest alloc] init];
    68 compMultipartRequest.bucket = @"<bucketname>";
    69 compMultipartRequest.key = @"<objectname>";
    70 compMultipartRequest.uploadId = uploadID;
    71 compMultipartRequest.parts = parts;
    72 __block BOSCompleteMultipartUploadResponse* complResponse = nil;
    73 task = [client completeMultipartUpload:compMultipartRequest];
    74 task.then(^(BCEOutput* output) {
    75     if (output.response) {
    76         complResponse = (BOSCompleteMultipartUploadResponse*)output.response;
    77         NSLog(@"complte multiparts success!");
    78     }
    79     if (output.error) {
    80         NSLog(@"complte multiparts failure %@", output.error);
    81     }
    82 });
    83 [task waitUtilFinished];
    84}

Cancel multipart upload

Users can cancel multipart uploads by using the abortMultipartUpload method.

  • Example code

    Swift
    1BOSAbortMultipartUploadRequest* abortRequest = [[BOSAbortMultipartUploadRequest alloc] init];
    2abortRequest.bucket = @"bucket";
    3abortRequest.key = @"<objectname>";
    4abortRequest.uploadId = uploadID;
    5__block BOSAbortMultipartUploadResponse* abortResponse = nil;
    6task = [client abortMultipartUpload:abortRequest];
    7task.then(^(BCEOutput* output) {
    8  if (output.response) {
    9      abortResponse = (BOSAbortMultipartUploadResponse*)output.response;
    10      NSLog(@"abort multiparts success!");
    11  }
    12  if (output.error) {
    13      NSLog(@"abort multiparts failure %@", output.error);
    14  }
    15});
    16[task waitUtilFinished];

Retrieve unfinished multipart uploads

Users can obtain the unfinished multipart upload events in the bucket by the listMultipartUploads method.

  • Basic workflow

    1. Create an instance of the BOSListMultipartUploadsRequest class, and pass in the parameter <BucketName>.
    2. Instantiate the BOSClient class and call its listMultipartUploads method.
    3. The listMultipartUploads method provides details about all ongoing multipart uploads.
  • Example code

    Swift
    1BOSListMultipartUploadsRequest* listMultipartRequest = [[BOSListMultipartUploadsRequest alloc] init];
    2listMultipartRequest.bucket = @"<bucketname>";
    3__block BOSListMultipartUploadsResponse* listMultipartResponse = nil;
    4task = [client listMultipartUploads:listMultipartRequest];
    5task.then(^(BCEOutput* output) {
    6  if (output.response) {
    7      listMultipartResponse = (BOSListMultipartUploadsResponse*)output.response;
    8      NSLog(@"list multipart success");
    9  }
    10  if (output.error) {
    11      NSLog(@"list multipart failure %@", output.error);
    12  }
    13});
    14[task waitUtilFinished];
    Plain Text
    1> **Note:**
    2>
    3> -   By default, if there are more than 1,000 multipart upload events in a bucket, only 1,000 entries will be returned. The IsTruncated field in the response will be True, and the nextKeyMarker will indicate the starting point for subsequent data.  
    4> -   To fetch additional multipart upload events, use the keyMarker parameter to read data in batches.  
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSListMultipartUploadsRequest* listMultipartRequest = [[BOSListMultipartUploadsRequest alloc] init];
    12    listMultipartRequest.bucket = @"<bucketname>";
    13    __block BOSListMultipartUploadsResponse* listMultipartResponse = nil;
    14    BCETask* task = [client listMultipartUploads:listMultipartRequest];
    15    task.then(^(BCEOutput* output) {
    16      if (output.response) {
    17          listMultipartResponse = (BOSListMultipartUploadsResponse*)output.response;
    18          NSLog(@"list multipart success");
    19      }
    20      if (output.error) {
    21          NSLog(@"list multipart failure %@", output.error);
    22      }
    23    });
    24    [task waitUtilFinished];
    25    for (BOSMultipartUpload* upload in listMultipartResponse.uploads) {
    26        NSLog(@"upload id : %@", upload.uploadId);
    27    }
    28}

Get all uploaded part information

Users can obtain all uploaded parts in an upload event by the listParts method.

  • Basic workflow

    1. Create an instance of the BOSListPartsRequest class, and pass in the parameters <BucketName>, <ObjectKey> and <UploadId>
    2. Instantiate the BOSClient class and call its listParts method.
    3. The listParts method provides information about all the parts that have been uploaded.
  • Example code

    Swift
    1BOSListPartsRequest* listPartsRequest = [[BOSListPartsRequest alloc] init];
    2listPartsRequest.bucket = @"<bucketname>";
    3listPartsRequest.key = @"<objectname>";
    4listPartsRequest.uploadId = @"<upload id>";;
    5__block BOSListPartsResponse* listPartsResponse = nil;
    6BCETask* task = [client listParts:listPartsRequest];
    7task.then(^(BCEOutput* output) {
    8  if (output.response) {
    9      listPartsResponse = (BOSListPartsResponse*)output.response;
    10      NSLog(@"list parts success!");
    11  }
    12  if (output.error) {
    13      NSLog(@"list part failure %@", output.error);
    14  }
    15});
    16[task waitUtilFinished];
    17for (BOSPart* part in listPartsResponse.parts) {
    18    NSLog(@"part etag %@", part.eTag);
    19}
    Plain Text
    1> **Note:**
    2>
    3> -   By default, if the number of multipart upload events in a bucket surpasses 1,000, only 1,000 records will be returned. In such cases, the IsTruncated value in the response will be True, and the NextPartNumberMarker will indicate the starting point for the next query.  
    4> -   To retrieve more information about uploaded parts, use the PartNumberMarker parameter to fetch data in batches.  
  • Complete example

    Swift
    1#import <BaiduBCEBasic/BaiduBCEBasic.h>
    2#import <BaiduBCEBOS/BaiduBCEBOS.h>
    3void example(void) {
    4 // Initialize
    5    BCECredentials* credentials = [[BCECredentials alloc] init];
    6    credentials.accessKey = @"<access key>";
    7    credentials.secretKey = @"<secret key>";
    8    BOSClientConfiguration* configuration = [[BOSClientConfiguration alloc] init];
    9    configuration.credentials = credentials;
    10    BOSClient* client = [[BOSClient alloc] initWithConfiguration:configuration];
    11    BOSListPartsRequest* listPartsRequest = [[BOSListPartsRequest alloc] init];
    12    listPartsRequest.bucket = @"<bucketname>";
    13    listPartsRequest.key = @"<objectname>";
    14    listPartsRequest.uploadId = @"<upload id>";;
    15    __block BOSListPartsResponse* listPartsResponse = nil;
    16    BCETask* task = [client listParts:listPartsRequest];
    17    task.then(^(BCEOutput* output) {
    18    if (output.response) {
    19        listPartsResponse = (BOSListPartsResponse*)output.response;
    20        NSLog(@"list parts success!");
    21    }
    22    if (output.error) {
    23        NSLog(@"list part failure %@", output.error);
    24    }
    25    });
    26    [task waitUtilFinished];
    27    for (BOSPart* part in listPartsResponse.parts) {
    28        NSLog(@"part etag %@", part.eTag);
    29    }
    30}

Previous
Log
Next
Bucket management