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
  • C-Dotnet-SDK
  • arrow
  • Object management
Table of contents on this page
  • Upload Object
  • Simplest upload
  • Set object's HTTP Header
  • User-defined metadata
  • Complete example
  • View the object in the bucket.
  • Simple query
  • Extended query
  • Query simulated folders
  • Complete example
  • Get Object
  • Simple object get
  • Obtain object via GetObjectRequest
  • Directly download object to a specified path
  • Obtain only ObjectMetadata
  • Get object URL
  • Complete example
  • Delete Object
  • Copy Object
  • Simply Copy Object
  • Copy Object via CopyObjectRequest
  • Complete example
  • Multipart upload of objects
  • Complete Multipart Upload in parts
  • Cancel multipart upload event
  • Get unfinished multipart upload event
  • Get all uploaded information
  • Complete example
  • Support single-link rate limit
  • Example of single-link speed-limited upload and download APIs

Object management

Updated at:2025-11-03

Upload Object

Simplest upload

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. Invoke the BosClient.PutObject() method. When using this method, ensure you provide the bucket name, ObjectKey, and the object's content. You can upload the object in one of the following ways: as a file, a data stream, a binary string, or a standard string.
  • Example code

    C#
    1public void PutObject(BosClient client, String bucketName, String objectKey, byte[] byte1, String string1)
    2{
    3 // Get specified file
    4 ileInfo file = new FileInfo(<FilePath>);    //Specify the file path
    5 // Upload object as a file
    6    PutObjectResponse putObjectFromFileResponse = client.PutObject(bucketName, objectKey, file);
    7 // Obtain data stream
    8    Stream inputStream = file.OpenRead();
    9 // Upload an object in the form of a data stream
    10    PutObjectResponse putObjectResponseFromInputStream = client.PutObject(bucketName, objectKey, inputStream);
    11 // Upload object as binary string
    12    PutObjectResponse putObjectResponseFromByte = client.PutObject(bucketName, objectKey,Encoding.Default.GetBytes("sampledata"));
    13 // Upload object in string form
    14    PutObjectResponse putObjectResponseFromString = client.PutObject(bucketName, objectKey, "sampledata");
    15 // Print ETag
    16    Console.WriteLine(putObjectFromFileResponse.ETAG);
    17}

Note: Files are uploaded to BOS as objects. The putObject function supports uploading objects with a size of up to 5 GB. Once the putObject request is successfully processed, BOS will include the object's ETag in the response header, serving as the file identifier.

  • Complete example

    Please refer to [complete example](#Complete example).

Set object's HTTP Header

BOS allows setting Http Headers when uploading an object.

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. When using BosClient.PutObject(), you can also provide an ObjectMetadata object, allowing you to set custom HTTP headers.
  • Example code

    C#
    1//Initialize the upload input stream
    2ObjectMetadata meta = new ObjectMetadata();
    3 // Set ContentLength size
    4meta.ContentLength = <Length>;
    5 // Set ContentType
    6meta.ContentType = "application/json";
    7client.PutObject(bucketName, objectKey, <SampleData>, meta);
  • Complete example

    Please refer to [complete example](#Complete example).

User-defined metadata

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. When using BosClient.PutObject(), you can also provide an ObjectMetadata object, enabling you to set custom metadata to describe the object.
  • Example code

    C#
    1// Set the value of custom metadata name to my-data
    2meta.UserMetadata["name"] = "my-data";
    3 // Upload Object
    4client.PutObject(bucketName, objectKey, <SampleData>, meta);

    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

    Please refer to [complete example](#Complete example).

Complete example

The following sample code demonstrates the complete process of simply uploading an object, setting the HTTP header of the object, and user-defined metadata:

C#
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Text;
6using BaiduBce;
7using BaiduBce.Auth;
8using BaiduBce.Services.Bos;
9using BaiduBce.Services.Bos.Model;
10namespace DotnetSample
11{
12    internal class PutObjectSample
13    {
14        private static void Main(string[] args)
15        {
16            BosClient client = GenerateBosClient();
17 const string bucketName = <BucketName>;    //Your bucket name
18 const string objectNameFile = <ObjectNameFile>;//Name of the object uploaded in file form
19 const string objectNameStream = <ObjectNameStream>; //Name of the object uploaded in data stream form
20 const string objectNameString = <ObjectNameString>; //Name of the object uploaded in string form
21 const string objectNameByte = <ObjectNameByte>; //Name of the object uploaded in binary form
22 // Create a new bucket
23 client.CreateBucket(bucketName); //Specify bucket name
24 //Set the file name to be uploaded
25            const string fileName = "d:\\sample.txt";
26 // Upload object as a file
27            PutObjectResponse putObjectFromFileResponse = client.PutObject(bucketName, objectNameFile,
28                new FileInfo(fileName));
29 // Upload an object in the form of a data stream
30            PutObjectResponse putObjectResponseFromInputStream = client.PutObject(bucketName, objectNameStream,
31                new FileInfo(fileName).OpenRead());
32 // Upload object as binary string
33            PutObjectResponse putObjectResponseFromByte = client.PutObject(bucketName, objectNameByte,
34                Encoding.Default.GetBytes("sampledata"));
35 // Upload object in string form
36            PutObjectResponse putObjectResponseFromString = client.PutObject(bucketName, objectNameString,
37                "sampledata");
38 //Print the ETags of the four methods. In the example, the ETag of the file method and the stream method are equal, and the ETag of the string method and the byte method are equal
39            Console.WriteLine(putObjectFromFileResponse.ETAG);
40            Console.WriteLine(putObjectResponseFromInputStream.ETAG);
41            Console.WriteLine(putObjectResponseFromByte.ETAG);
42            Console.WriteLine(putObjectResponseFromString.ETAG);
43 //Upload the object and set custom parameters
44            ObjectMetadata meta = new ObjectMetadata();
45 // Set ContentLength size
46            meta.ContentLength = 10;
47 // Set ContentType
48            meta.ContentType = "application/json";
49 // Set the value of custom metadata name to my-data
50            meta.UserMetadata["name"] = "my-data";
51 //Upload the object and print the ETag
52            putObjectResponseFromString = client.PutObject(bucketName, objectNameString, "sampledata", meta);
53            Console.WriteLine(putObjectResponseFromString.ETAG);
54        }
55        private static BosClient GenerateBosClient()
56        {
57 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
58 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
59 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
60 // Initialize a BOSClient
61            BceClientConfiguration config = new BceClientConfiguration();
62            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
63            config.Endpoint = endpoint;
64            return new BosClient(config);
65        }
66    }
67}

View the object in the bucket.

Simple query

View the list of objects in a bucket.

  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Invoke the BOSClient.ListObjects() method. Provide the bucket name as a parameter when using this method.
  • Example code

    C#
    1public void ListObjects(BosClient client, string bucketName)
    2{
    3 // Obtain all object information under the specified bucket
    4    ListObjectsResponse listObjectsResponse = client.ListObjects(bucketName);
    5 // Traverse all objects
    6    foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
    7    {
    8        Console.WriteLine("ObjectKey: " + objectSummary.Key);
    9    }
    10}

    Note: The listObjects() method returns a ListObjectsResponse object, which contains the results of this listObject request. Users can obtain the description information of all objects through the getContents method in ListObjectsResponse.

    • By default, if the number of objects in the bucket exceeds 1,000, only 1,000 objects will be returned. In this case, the IsTruncated value in the returned result will be set to True, and NextMarker will be provided as the starting point for the next retrieval.
    • To retrieve more objects, use the Marker parameter for reading in batches. Refer to [Extended Query](#Extended query).
  • Complete example

    Please refer to [complete example](#Complete example - 1).

Extended query

Users can configure the ListObjectsRequest parameters to perform advanced query operations. The extended parameters available for configuration in ListObjectsRequest include the following:

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 It is a string used to set the starting position of the returned results.
After setting the Marker value, the returned objects will be returned starting from the Marker value in alphabetical order.
-
  • Basic workflow

    1. Instantiate the BOSClient class.
    2. Alternatively, construct a ListObjectsRequest to invoke methods like ListObjects() and ListObjectsRequest, enabling more advanced query operations.
  • Example code

    C#
    1// Construct a ListObjectsRequest request
    2ListObjectsRequest listObjectsRequest = new ListObjectsRequest() {BucketName = bucketName};
    3 // Set parameters
    4listObjectsRequest.Delimiter=<Delimiter>;
    5listObjectsRequest.Marker=<Marker>;
    6ListObjectsResponse listObjectsResponse = client.ListObjects(listObjectsRequest);

    Description:

    The above code calls an overloaded method from listObjects by passing a ListObjectsRequest to complete the request.

  • Complete example

    Please refer to [complete example](#Complete example - 1).

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 in the a directory by setting the Prefix parameter:

C#
1// Construct a ListObjectsRequest request
2ListObjectsRequest listObjectsRequest = new ListObjectsRequest() {BucketName = bucketName};
3 // Recursively list all files under the fun directory
4listObjectsRequest.Prefix = "fun/";
5// List Objects
6ListObjectsResponse listObjectsResponse = client.ListObjects(listObjectsRequest);
7 // Traverse all objects
8Console.WriteLine("Objects:");
9foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
10{
11    Console.WriteLine("ObjectKey: " + objectSummary.Key);
12}

Output:

Csahrp
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:

C#
1// Construct a ListObjectsRequest request
2ListObjectsRequest listObjectsRequest = new ListObjectsRequest() {BucketName = bucketName};
3 // "/" is the delimiter for folders
4listObjectsRequest.Delimiter = "/";
5 //List all files and folders under the “fun” directory
6listObjectsRequest.Prefix = "fun/";
7// List Objects
8ListObjectsResponse listObjectsResponse = client.ListObjects(listObjectsRequest);
9 //Traverse all objects, which is equivalent to retrieving all files under the “fun” directory
10Console.WriteLine("Objects:");
11foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
12{
13    Console.WriteLine("ObjectKey: " + objectSummary.Key);
14}
15 //Traverse all CommonPrefixes, which is equivalent to getting all subfolders under the “fun” directory
16Console.WriteLine("\nCommonPrefixs:");
17foreach (ObjectPrefix objectPrefix in listObjectsResponse.CommonPrefixes)
18{
19    Console.WriteLine(objectPrefix.Prefix);
20}

Output:

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

Description:

In the returned results, the list under Objects 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.

  • Complete example

    Please refer to [complete example](#Complete example - 1).

Complete example

The following sample code demonstrates the complete process of simple query of objects, batch query using nextmarker, extended query, and query of simulated folders:

C#
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using BaiduBce;
6using BaiduBce.Auth;
7using BaiduBce.Services.Bos;
8using BaiduBce.Services.Bos.Model;
9namespace DotnetSample
10{
11    internal class ListObjectsSample
12    {
13        private static void Main(string[] args)
14        {
15            BosClient client = GenerateBosClient();
16 const string bucketName = <BucketName>;    //Your bucket name
17 // Create a new bucket
18            client.CreateBucket(bucketName);
19 //Create five files: bos.jpg, fun/, fun/test.jpg, fun/movie/001.avi, fun/movie/007.avi
20            client.PutObject(bucketName, "bos.jpg", "sampledata");
21            client.PutObject(bucketName, "fun/", "sampledata");
22            client.PutObject(bucketName, "fun/test.jpg", "sampledata");
23            client.PutObject(bucketName, "fun/movie/001.avi", "sampledata");
24            client.PutObject(bucketName, "fun/movie/007.avi", "sampledata");
25 // Construct a ListObjectsRequest request
26            ListObjectsRequest listObjectsRequest = new ListObjectsRequest() { BucketName = bucketName };
27 //1. Simple query: list all files under the bucket
28            ListObjectsResponse listObjectsResponse = client.ListObjects(listObjectsRequest);
29 //Output:
30            // Objects:
31            // bos.jpg
32            // fun/
33            // fun/movie/001.avi
34            // fun/movie/007.avi
35            // fun/test.jpg
36            Console.WriteLine("Objects:");
37            foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
38            {
39                Console.WriteLine("ObjectKey: " + objectSummary.Key);
40            }
41 //2. Use NextMarker to list all files in batches
42            listObjectsRequest.MaxKeys = 2;
43            listObjectsResponse = client.ListObjects(listObjectsRequest);
44 //Output:
45            // Objects:
46            // bos.jpg
47            // fun/
48            // fun/movie/001.avi
49            // fun/movie/007.avi
50            // fun/test.jpg
51            Console.WriteLine("Objects:");
52            while (listObjectsResponse.IsTruncated)
53            {
54                foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
55                {
56                    Console.WriteLine("ObjectKey: " + objectSummary.Key);
57                }
58                listObjectsResponse = client.ListNextBatchOfObjects(listObjectsResponse);
59            }
60            foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
61            {
62                Console.WriteLine("ObjectKey: " + objectSummary.Key);
63            }
64 //3. Recursively list all files and subfolders under the “fun/”
65            listObjectsRequest.Prefix = "fun/";
66            listObjectsResponse = client.ListObjects(listObjectsRequest);
67 //Output:
68            // Objects:
69            // fun/
70            // fun/movie/001.avi
71            // fun/movie/007.avi
72            // fun/test.jpg
73            Console.WriteLine("Objects:");
74            foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
75            {
76                Console.WriteLine("ObjectKey: " + objectSummary.Key);
77            }
78 //4. List all files and subfolders under the “fun”
79            listObjectsRequest.Delimiter = "/";
80            listObjectsResponse = client.ListObjects(listObjectsRequest);
81 //Output:
82            // Objects:
83            // fun/
84            // fun/test.jpg
85            Console.WriteLine("Objects:");
86            foreach (BosObjectSummary objectSummary in listObjectsResponse.Contents)
87            {
88                Console.WriteLine("ObjectKey: " + objectSummary.Key);
89            }
90 //Traverse all CommonPrefixes, which is equivalent to getting all subfolders under the “fun” directory
91 //Output:
92            // CommonPrefixs:
93            // fun/movie
94            Console.WriteLine("\nCommonPrefixs:");
95            foreach (ObjectPrefix objectPrefix in listObjectsResponse.CommonPrefixes)
96            {
97                Console.WriteLine(objectPrefix.Prefix);
98            }
99        }
100        private static BosClient GenerateBosClient()
101        {
102 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
103 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
104 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
105 // Initialize a BOSClient
106            BceClientConfiguration config = new BceClientConfiguration();
107            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
108            config.Endpoint = endpoint;
109            return new BosClient(config);
110        }
111    }
112}

Get Object

Simple object get

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. Execute the BosClient.GetObject() method to retrieve the specified BosObject.
    3. Load the BosObject into a stream for further processing.
  • Example code

    C#
    1public void GetObject(BosClient client, String bucketName, String objectKey)
    2{
    3 //Obtain the object, with returned result BosObject object
    4    BosObject bosObject = client.GetObject(bucketName, objectKey);
    5 // Retrieve ObjectMeta
    6    ObjectMetadata meta = bosObject.ObjectMetadata;
    7 //Obtain the object's input stream
    8    Stream objectContent = bosObject.ObjectContent;
    9 // Process object
    10    ...
    11 // Close stream
    12    objectContent.Close();
    13}

    Note:

    • BosObject contains various information about the Object, including the bucket where the object is located, the name of the object, MetaData, and a input stream.
    • You can read the object's content into a file or memory by operating on the input stream.
    • ObjectMetadata contains information such as the ETag defined during object upload, HTTP headers, and custom metadata.
    • Using the getObjectContent() method of BosObject, users can access the input stream of the returned object, enabling them to read and process the object's content.
  • Complete example

    Please refer to [complete example](#Complete example - 2).

Obtain object via GetObjectRequest

To unlock more capabilities, GetObjectRequest can be used to retrieve objects.

  • Basic workflow

    1. Create an instance of the GetObjectRequest class.
    2. Invoke the setRange() method on GetObjectRequest to retrieve specific byte ranges from the object.
    3. Perform the GetObject() operation.
  • Example code

    C#
    1// Create GetObjectRequest
    2 GetObjectRequest getObjectRequest = new GetObjectRequest() {BucketName = bucketName, Key = objectKey};
    3 // Obtain data within the 0~100 byte range
    4getObjectRequest.SetRange(0, 100);
    5 //Obtain the object, with returned result BosObject object
    6BosObject bosObject = client.GetObject(getObjectRequest);

    Note: The setRange() method in GetObjectRequest allows users to specify a range for the returned object. This feature can be used to implement segmented downloads and resumable uploads.

  • Complete example

    Please refer to [complete example](#Complete example - 2).

Directly download object to a specified path

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

  • Basic workflow

    1. Create an instance of the GetObjectRequest class.
    2. Execute the client.getObject() operation.
    3. Download an object directly to a specified path.
  • Example code

    C#
    1// Create GetObjectRequest
    2GetObjectRequest getObjectRequest = new GetObjectRequest() {BucketName = bucketName, Key = objectKey};
    3 // Download object to file
    4ObjectMetadata objectMetadata = client.GetObject(getObjectRequest, new FileInfo("d:\\sample.txt"));

    Note: When using the above method to directly download an object to a specified path, the method returns an ObjectMetadata object.

  • Complete example

    Please refer to [complete example](#Complete example - 2).

Obtain only ObjectMetadata

The getObjectMetadata() method retrieves only the ObjectMetadata, without obtaining the object itself.

  • Example code

    C#
    1ObjectMetadata objectMetadata = client.GetObjectMetadata(bucketName, objectKey);
  • Complete example

    Please refer to [complete example](#Complete example - 2).

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. Create an instance of the BOSClient class.
    2. Use the BosClient.GeneratePresignedUrl() method. Supply parameters like the bucket name, object name, and expiration time when calling this method.
    3. The method returns the URL of the object.
  • Example code

    C#
    1public string GeneratePresignedUrl(BosClient client, string bucketName, string objectKey,
    2          int expirationInSeconds)
    3{
    4 //Specify the name of the bucket where the object that the user needs to get is located, the name of the object, timestamp and the valid duration of the URL
    5   Uri url = client.GeneratePresignedUrl(bucketName, objectKey, expirationInSeconds);             
    6   return url.AbsoluteUri;
    7}

    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 s 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

    Please refer to [complete example](#Complete example - 2).

Complete example

The following sample code demonstrates the complete process of simply getting an object, getting an object through GetObjectRequest, directly downloading an object to a specified path, only getting ObjectMetadata, and getting the URL of the object:

C#
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Text;
6using BaiduBce;
7using BaiduBce.Auth;
8using BaiduBce.Services.Bos;
9using BaiduBce.Services.Bos.Model;
10namespace DotnetSample
11{
12    internal class GetObjectsSample
13    {
14        private static void Main(string[] args)
15        {
16            BosClient client = GenerateBosClient();
17 const string bucketName = <BucketName>;    //Your bucket name
18 //Initialization: create a bucket and an object
19            client.CreateBucket(bucketName);
20            string objectName = <ObjectKey>;
21            client.PutObject(bucketName, objectName, <SampleData>);
22 //Get the BosObject object and get the content through the input stream of BosObject
23            BosObject bosObject = client.GetObject(bucketName, objectName);
24            Stream objectContent = bosObject.ObjectContent;
25            string content = new StreamReader(objectContent).ReadToEnd();
26 Console.WriteLine(content);//<SampleData> you specified
27 //Get only part of the data through GetObjectRequest
28            GetObjectRequest getObjectRequest = new GetObjectRequest() {BucketName = bucketName, Key = objectName};
29            getObjectRequest.SetRange(0, 5);
30            bosObject = client.GetObject(getObjectRequest);
31            objectContent = bosObject.ObjectContent;
32            content = new StreamReader(objectContent).ReadToEnd();
33 Console.WriteLine(content);//<SampleData> you specified
34 //Directly get the byte[] content through GetObjectContent
35            byte[] bytes = client.GetObjectContent(bucketName, objectName);
36            content = Encoding.Default.GetString(bytes);
37 Console.WriteLine(content);//<SampleData> you specified
38 // Download object content to file
39            FileInfo fileInfo = new FileInfo("my file path and name");
40            client.GetObject(bucketName, objectName,fileInfo );
41            content = File.ReadAllText(fileInfo.FullName);
42 Console.WriteLine(content);//<SampleData> you specified
43 //Only get the object’s meta, not the content
44            ObjectMetadata objectMetadata = client.GetObjectMetadata(bucketName, objectName);
45            Console.WriteLine(objectMetadata.ContentLength);
46            Console.ReadKey();
47 //Generate a URL and directly download and print the object content through this URL
48            string url = client.GeneratePresignedUrl(bucketName, objectName, 60).AbsoluteUri;
49            using (WebClient webClient = new WebClient())
50            {
51                using (Stream stream = webClient.OpenRead(url))
52                using (StreamReader streamReader = new StreamReader(stream))
53                {
54                    string response = streamReader.ReadToEnd();
55 Console.WriteLine(response);//<SampleData> you specified
56                }
57            }
58        }
59        private static BosClient GenerateBosClient()
60        {
61 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
62 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
63 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
64 // Initialize a BOSClient
65            BceClientConfiguration config = new BceClientConfiguration();
66            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
67            config.Endpoint = endpoint;
68            return new BosClient(config);
69        }
70    }
71}

Delete Object

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. Invoke the BosClient.DeleteObject() method. Provide parameters such as the bucket name and object name when calling this method.
  • Example code

    C#
    1public void DeleteObject(BosClient client, string bucketName, string objectKey)
    2{
    3 // Delete Object
    4client.DeleteObject(bucketName, objectKey);
    5}
  • Complete example

    C#
    1using System;
    2using System.Collections.Generic;
    3using System.IO;
    4using System.Linq;
    5using System.Net;
    6using System.Text;
    7using BaiduBce;
    8using BaiduBce.Auth;
    9using BaiduBce.Services.Bos;
    10using BaiduBce.Services.Bos.Model;
    11namespace DotnetSample
    12{
    13    internal class DeleteObjectSample
    14    {
    15        private static void Main(string[] args)
    16        {
    17            BosClient client = GenerateBosClient();
    18 const string bucketName = <BucketName>;     //Specify bucket name
    19 //Initialization: create a bucket sample and an object
    20            client.CreateBucket(bucketName);
    21            string objectName = <ObjectKey>;
    22            client.PutObject(bucketName, objectName, <Sampledata>);
    23 // Delete Object
    24            client.DeleteObject(bucketName, objectName);
    25        }
    26        private static BosClient GenerateBosClient()
    27        {
    28 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
    29 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
    30 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
    31 // Initialize a BOSClient
    32            BceClientConfiguration config = new BceClientConfiguration();
    33            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
    34            config.Endpoint = endpoint;
    35            return new BosClient(config);
    36        }
    37    }
    38}

Copy Object

Simply Copy Object

  • Basic workflow

    1. Initialize an instance of the BOSClient class.
    2. Execute the BosClient.copyObject() method.
  • Example code

    C#
    1public void CopyObject(BosClient client, String srcBucketName, String srcKey, String destBucketName,
    2String destKey)
    3{
    4 // Copy Object
    5   CopyObjectResponse copyObjectResponse = client.CopyObject(srcBucketName, srcKey, destBucketName, destKey);
    6 // Print results
    7   Console.WriteLine("ETag: " + copyObjectResponse.ETag + " LastModified: " + copyObjectResponse.LastModified);
    8}

    Note: The copyObject method returns a CopyObjectResponse object containing the new object's ETag and modification time.

  • Complete example

    Please refer to [complete example](#Complete example - 3).

Copy Object via CopyObjectRequest

You can also copy object via CopyObjectRequest This function is typically used in the following scenarios:

  • Copy an object while resetting its metadata.
  • Reset the metadata of an existing object (set the source and destination to the same object).
  • Basic workflow

    1. Create an instance of the CopyObjectRequest class, and pass in the parameters <SrcBucketName>, <SrcKey>, <DestBucketName>, <DestKey>.
    2. Create an ObjectMetadata instance.
  • Example code

    C#
    1// Initialize BosClient
    2BosClient client = ...;
    3 // Create CopyObjectRequest object
    4CopyObjectRequest copyObjectRequest = new CopyObjectRequest()
    5{
    6    SourceBucketName = srcBucketName,
    7    SourceKey = srcKey,
    8    BucketName = destBucketName,
    9    Key = destKey
    10};
    11 // Set new Metadata
    12Dictionary<String, String> userMetadata = new Dictionary<String, String>();
    13userMetadata["usermetakey"] = "usermetavalue";
    14ObjectMetadata objectMetadata = new ObjectMetadata()
    15{
    16    UserMetadata = userMetadata
    17};
    18copyObjectRequest.NewObjectMetadata = objectMetadata;
    19 //Copy the object and print new ETag
    20CopyObjectResponse copyObjectResponse = client.CopyObject(copyObjectRequest);
    21Console.WriteLine("ETag: " + copyObjectResponse.ETag + " LastModified: " + copyObjectResponse.LastModified);

    Note:CopyObjectRequest allows users to modify the ObjectMeta of the target object and also provides the setting of the MatchingETagConstraints parameter.

  • Complete example

    Please refer to [complete example](#Complete example - 3).

Complete example

The following sample code demonstrates the complete process of simply copying an object and copying an object through CopyObjectRequest:

C#
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Net;
6using System.Text;
7using BaiduBce;
8using BaiduBce.Auth;
9using BaiduBce.Services.Bos;
10using BaiduBce.Services.Bos.Model;
11namespace DotnetSample
12{
13    internal class CopyObjectSample
14    {
15        private static void Main(string[] args)
16        {
17            BosClient client = GenerateBosClient();
18            const string bucketName = <SrcBucketName>;
19 //Initialization: create a bucket sample and an object
20            client.CreateBucket(bucketName);
21            string objectName = <SrcObjectKey>;
22            client.PutObject(bucketName, objectName, <SrcSampleData>);
23 //Ordinary copy and print the result
24            string newObjectName = <DesObjectKey>;
25            CopyObjectResponse copyObjectResponse = client.CopyObject(bucketName, objectName, bucketName,
26                newObjectName);
27            Console.WriteLine(Encoding.Default.GetString(client.GetObjectContent(bucketName, newObjectName)));
28 //Copy and set new meta
29            newObjectName = <DesObjectKey>;
30            CopyObjectRequest copyObjectRequest = new CopyObjectRequest()
31            {
32                SourceBucketName = bucketName,
33                SourceKey = objectName,
34                BucketName = bucketName,
35                Key = newObjectName
36            };
37            Dictionary<String, String> userMetadata = new Dictionary<String, String>();
38            userMetadata["usermetakey"] = "usermetavalue";
39            ObjectMetadata objectMetadata = new ObjectMetadata()
40            {
41                UserMetadata = userMetadata
42            };
43            copyObjectRequest.NewObjectMetadata = objectMetadata;
44            client.CopyObject(copyObjectRequest);
45            // usermetavalue
46            Console.WriteLine(client.GetObjectMetadata(bucketName, newObjectName).UserMetadata["usermetakey"]);
47        }
48        private static BosClient GenerateBosClient()
49        {
50 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
51 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
52 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
53 // Initialize a BOSClient
54            BceClientConfiguration config = new BceClientConfiguration();
55            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
56            config.Endpoint = endpoint;
57            return new BosClient(config);
58        }
59    }
60}

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 d:\sample.txt. Due to the large size of the file, it will be transmitted to BOS in parts.

  • Basic workflow

    1. Create an instance of the BOSClient class.
    2. Call the BosClient.InitiateMultipartUpload() method. When using this method, provide the bucket name and object name. The method will return an UploadId needed for subsequent steps.
    3. Invoke the BosClient.UploadPart method multiple times to upload the file in parts. Supply parameters such as the bucket name, object name, UploadId, part sequence number, part size, and part content. Each invocation returns the sequence number and ETag of that part for use in later steps.
    4. Use the BosClient.CompleteMultipartUpload() method to finalize the multipart upload. You need to provide the bucket name, object name, UploadId, and sequence numbers and ETags of all parts.
    5. During the upload process, you may utilize the BosClient.ListParts() method to obtain all uploaded parts associated with a specified UploadId. Alternatively, the BosClient.ListMultipartUploads() method can retrieve all unfinished UploadIds in a specific bucket.

Initialize multipart upload

Use InitiateMultipartUpload method to initialize a multipart upload event:

  • Example code

    C#
    1// Initiate Multipart Upload
    2InitiateMultipartUploadRequest initiateMultipartUploadRequest =
    3         new InitiateMultipartUploadRequest() {BucketName = bucketName, Key = objectKey};
    4InitiateMultipartUploadResponse initiateMultipartUploadResponse =
    5         client.InitiateMultipartUpload(initiateMultipartUploadRequest);
    6 // Print UploadId
    7Console.WriteLine("UploadId: " + initiateMultipartUploadResponse.UploadId);

    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

    C#
    1// Set each part to 5MB
    2long partSize = 1024 * 1024 * 5L;
    3FileInfo partFile = new FileInfo("my file");
    4 // Calculate the count of parts
    5int partCount = (int) (partFile.Length / partSize);
    6if (partFile.Length % partSize != 0)
    7{
    8   partCount++;
    9}
    10 // Create a list to save the ETag and PartNumber of each uploaded part
    11List<PartETag> partETags = new List<PartETag>();
    12for (int i = 0; i < partCount; i++)
    13{
    14 // Get file stream
    15   Stream stream = partFile.OpenRead();
    16 //Jump to the beginning of each part
    17   long skipBytes = partSize * i;
    18   stream.Seek(skipBytes, SeekOrigin.Begin);
    19 // Calculate the size of each part
    20   long size = Math.Min(partSize, partFile.Length - skipBytes);
    21 // Create UploadPartRequest to upload parts
    22   uploadPartRequest uploadPartRequest = new UploadPartRequest();
    23   uploadPartRequest.BucketName = bucketName;
    24   uploadPartRequest.Key = objectKey;
    25   uploadPartRequest.UploadId = initiateMultipartUploadResponse.UploadId;
    26   uploadPartRequest.InputStream = stream;
    27   uploadPartRequest.PartSize = size;
    28   uploadPartRequest.PartNumber = i + 1;
    29   UploadPartResponse uploadPartResponse = client.UploadPart(uploadPartRequest);
    30 // Save the returned PartETag to the List.
    31   partETags.Add(new PartETag()
    32   {
    33      ETag = uploadPartResponse.ETag,
    34      PartNumber = uploadPartResponse.PartNumber
    35    });
    36 // Close the file
    37   stream.Close();
    38   }

    Note:

    The core of the above code is to call the UploadPart method to upload each part, but the following points should be noted:

    • The multipart upload method requires each part, except the last one, to be at least 5 MB in size. However, the Upload Part API does not validate the part size; this validation only happens when completing the multipart upload.
    • 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.
    • 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.
    • For each uploaded part, the stream must be positioned at the beginning of the respective part.
    • After each Part upload, the return result of BOS will include a PartETag 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 PartETag objects will be saved in a List.

Complete multipart upload

  • Example code

    C#
    1CompleteMultipartUploadRequest completeMultipartUploadRequest =
    2new CompleteMultipartUploadRequest()
    3{
    4   BucketName = bucketName,
    5   Key = objectKey,
    6   UploadId = initiateMultipartUploadResponse.UploadId,
    7   PartETags = partETags
    8};
    9 // Complete multipart upload
    10CompleteMultipartUploadResponse completeMultipartUploadResponse =
    11client.CompleteMultipartUpload(completeMultipartUploadRequest);
    12 // Print Object's ETag
    13Console.WriteLine(completeMultipartUploadResponse.ETag);

    Note: The partETags in the above code is the list of partETag saved in the second step. After BOS receives the part list 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.

Cancel multipart upload event

Users can cancel multipart uploads by using the abortMultipartUpload method.

  • Example code

    C#
    1AbortMultipartUploadRequest abortMultipartUploadRequest = new AbortMultipartUploadRequest()
    2{
    3    BucketName = bucketName,
    4    Key = objectKey,
    5    UploadId = initiateMultipartUploadResponse.UploadId,
    6};
    7 // Cancel multipart upload
    8client.AbortMultipartUpload(abortMultipartUploadRequest);	

Get unfinished multipart upload event

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

  • Example code

    C#
    1ListMultipartUploadsRequest listMultipartUploadsRequest =
    2     new ListMultipartUploadsRequest() {BucketName = bucketName};
    3 // Retrieve all upload events within the bucket
    4ListMultipartUploadsResponse listMultipartUploadsResponse =
    5     client.ListMultipartUploads(listMultipartUploadsRequest);
    6 // Traverse all upload events
    7foreach (MultipartUploadSummary multipartUpload in listMultipartUploadsResponse.Uploads)
    8{
    9   Console.WriteLine("Key: " + multipartUpload.Key + " UploadId: " + multipartUpload.UploadId);
    10}

    Note:

    • By default, if a bucket contains more than 1,000 multipart upload events, only 1,000 will be returned. The IsTruncated value in the result will be True, and NextKeyMarker will indicate the starting point for the next query.
    • To fetch more multipart upload events, use the KeyMarker parameter to retrieve data in batches.

Get all uploaded information

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

  • Example code

    C#
    1ListPartsRequest listPartsRequest = new ListPartsRequest()
    2{
    3    BucketName = bucketName,
    4    Key = objectKey,
    5    UploadId = initiateMultipartUploadResponse.UploadId,
    6};
    7 // Retrieve all uploaded part information
    8ListPartsResponse listPartsResponse = client.ListParts(listPartsRequest);
    9 // Traverse all parts
    10foreach (PartSummary part in listPartsResponse.Parts)
    11{
    12     Console.WriteLine("PartNumber: " + part.PartNumber + " ETag: " + part.ETag);
    13}

    Note:

    • By default, if a bucket has more than 1,000 multipart upload events, only 1,000 parts will be returned. The IsTruncated value in the result will be True, and NextPartNumberMarker will indicate the starting point for the next query.
    • To retrieve more information about uploaded parts, use the PartNumberMarker parameter to fetch data in batches.

Complete example

The following sample code demonstrates the complete process of multipart upload:

C#
1using System;
2using System.Collections.Generic;
3using System.IO;
4using System.Linq;
5using System.Text;
6using BaiduBce;
7using BaiduBce.Auth;
8using BaiduBce.Services.Bos;
9using BaiduBce.Services.Bos.Model;
10namespace DotnetSample
11{
12    internal class MultiUploadSample
13    {
14        private static void Main(string[] args)
15        {
16            BosClient client = GenerateBosClient();
17 const string bucketName = <BucketName>;//Bucket name
18 //Initialization: create a sample bucket
19            client.CreateBucket(bucketName);
20            string objectKey = <ObjectKey>;
21 // Initiate Multipart Upload
22            InitiateMultipartUploadRequest initiateMultipartUploadRequest =
23                new InitiateMultipartUploadRequest() { BucketName = bucketName, Key = objectKey };
24            InitiateMultipartUploadResponse initiateMultipartUploadResponse =
25                client.InitiateMultipartUpload(initiateMultipartUploadRequest);
26 //Get Multipart Upload in the bucket
27            ListMultipartUploadsRequest listMultipartUploadsRequest =
28                new ListMultipartUploadsRequest() { BucketName = bucketName };       
29            ListMultipartUploadsResponse listMultipartUploadsResponse =
30                client.ListMultipartUploads(listMultipartUploadsRequest);
31            foreach (MultipartUploadSummary multipartUpload in listMultipartUploadsResponse.Uploads)
32            {
33                Console.WriteLine("Key: " + multipartUpload.Key + " UploadId: " + multipartUpload.UploadId);
34            }
35 //Multipart upload, first set each part to 5 MB
36            long partSize = 1024 * 1024 * 5L;
37            FileInfo partFile = new FileInfo("d:\\lzb\\sample");
38 // Calculate the count of parts
39            int partCount = (int)(partFile.Length / partSize);
40            if (partFile.Length % partSize != 0)
41            {
42                partCount++;
43            }
44 // Create a list to save the ETag and PartNumber of each uploaded part
45            List<PartETag> partETags = new List<PartETag>();
46            for (int i = 0; i < partCount; i++)
47            {
48 // Get file stream
49                Stream stream = partFile.OpenRead();
50 //Jump to the beginning of each part
51                long skipBytes = partSize * i;
52                stream.Seek(skipBytes, SeekOrigin.Begin);
53 // Calculate the size of each part
54                long size = Math.Min(partSize, partFile.Length - skipBytes);
55 // Create UploadPartRequest to upload parts
56                UploadPartRequest uploadPartRequest = new UploadPartRequest();
57                uploadPartRequest.BucketName = bucketName;
58                uploadPartRequest.Key = objectKey;
59                uploadPartRequest.UploadId = initiateMultipartUploadResponse.UploadId;
60                uploadPartRequest.InputStream = stream;
61                uploadPartRequest.PartSize = size;
62                uploadPartRequest.PartNumber = i + 1;
63                UploadPartResponse uploadPartResponse = client.UploadPart(uploadPartRequest);
64 // Save the returned PartETag to the List.
65                partETags.Add(new PartETag()
66                {
67                    ETag = uploadPartResponse.ETag,
68                    PartNumber = uploadPartResponse.PartNumber
69                });
70 // Close the file
71                stream.Close();
72            }
73 //Get all Upload Parts of the UploadId
74            ListPartsRequest listPartsRequest = new ListPartsRequest()
75            {
76                BucketName = bucketName,
77                Key = objectKey,
78                UploadId = initiateMultipartUploadResponse.UploadId,
79            };
80 // Retrieve all uploaded part information
81            ListPartsResponse listPartsResponse = client.ListParts(listPartsRequest);
82 // Traverse all parts
83            foreach (PartSummary part in listPartsResponse.Parts)
84            {
85                Console.WriteLine("PartNumber: " + part.PartNumber + " ETag: " + part.ETag);
86            }
87 // Complete multipart upload
88            CompleteMultipartUploadRequest completeMultipartUploadRequest =
89                new CompleteMultipartUploadRequest()
90                {
91                    BucketName = bucketName,
92                    Key = objectKey,
93                    UploadId = initiateMultipartUploadResponse.UploadId,
94                    PartETags = partETags
95                };
96            CompleteMultipartUploadResponse completeMultipartUploadResponse =
97                client.CompleteMultipartUpload(completeMultipartUploadRequest);
98            Console.WriteLine(completeMultipartUploadResponse.ETag);                  
99            Console.ReadKey();
100        }
101        private static BosClient GenerateBosClient()
102        {
103 const string accessKeyId = <AccessKeyID>;//Your Access Key ID
104 const string secretAccessKey = <SecretAccessKey>; //Your Secret Access Key
105 const string endpoint = "https://bj.bcebos.com";//Specify the BOS service domain name
106 // Initialize a BOSClient
107            BceClientConfiguration config = new BceClientConfiguration();
108            config.Credentials = new DefaultBceCredentials(accessKeyId, secretAccessKey);
109            config.Endpoint = endpoint;
110            return new BosClient(config);
111        }
112    }
113}

Support single-link rate limit

Baidu AI Cloud Object Storage (BOS) provides a public network bandwidth limit of 10 Gbit/s per bucket and an intranet bandwidth limit of 50 Gbit/s per bucket. When the upload or download usage reaches the bandwidth limit, the error code RequestRateLimitExceeded will be returned. To ensure normal service usage, BOS supports traffic control during uploads and downloads to prevent high traffic services from affecting other applications.

Example of single-link speed-limited upload and download APIs

The value range of the rate limit value is 819200~838860800 in bit/s, that is, 100KB/s~100MB/s. The rate limit value must be a number. BOS will limit the rate of this request according to the specified rate limit value. When the rate limit value is not within this range or is illegal, it will return the error code 400.

C#
1public void ObjectTrafficLimit(BosClient client, String bucketName, String objectKey, byte[] byte1, String string1)
2{
3 //Specific speed limit value
4    long trafficLimit = 819200;
5 // Get specified file
6 ileInfo file = new FileInfo(<FilePath>);    //Specify the file path
7 //Generate put request
8    PutObjectRequest putRequest = new PutObjectRequest()
9    {
10        BucketName = bucketName,
11        Key = objectKey,
12        FileInfo = file,
13        TrafficLimit = trafficLimit
14    };
15 // Upload object as a file
16    PutObjectResponse putObjectFromFileResponse = client.PutObject(putRequest);
17 // Print ETag
18    Console.WriteLine(putObjectFromFileResponse.ETAG);
19 //Generate get request
20    GetObjectRequest getRequest = new GetObjectRequest()
21    {
22        BucketName = bucketName,
23        Key = objectKey,
24        TrafficLimit = trafficLimit
25    };
26 //Get object
27    BosObject bosObject = client.GetObject(getRequest);
28 // Print ETag
29    Console.WriteLine(bosObject.ObjectMetadata.ETag);  
30}

Previous
Bucket management
Next
PHP-SDK