All Products
Search
Document Center

Object Storage Service:Copy objects using OSS SDK for Go 2.0

Last Updated:Oct 21, 2025

OSS SDK for Go 2.0 provides a set of distinct APIs for copying objects, catering to a range of use cases from simple, synchronous copies to large-scale, resumable multipart operations.

Type

API

Description

Copy an object (OSS SDK for Go 2.0)

Client.CopyObject

  • Suitable only for copying objects smaller than 5 GiB.

Multipart copy (OSS SDK for Go 2.0)

APIs for multipart copy:

Client.InitiateMultipartUpload

Client.UploadPartCopy

Client.CompleteMultipartUpload

  • Supports copying objects larger than 5 GiB.

  • This operation does not support the (x-oss-metadata-directive) or (x-oss-tagging-directive) parameters. Therefore, metadata and tags are not automatically copied from the source object. To add metadata or tags to the destination object, you must explicitly specify them in the copy request.

Copier (OSS SDK for Go 2.0)

APIs for the Copier:

Copier.Copy

  • Provides a generic copy API that hides the differences and implementation details of underlying APIs. It can automatically select an appropriate API to copy an object based on the copy request parameters.