You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Share objects
Download objects with the authorization code (share-cp)
Copy page
Download PDF
Download objects with the authorization code (share-cp)
You can use the share-cp command with an authorization code to download individual objects or download a batch of objects with a specific prefix to your local device.​
Notes​
Before using this command, make sure that the source objects in the bucket have not changed. Otherwise, this may result in inconsistent data or download failures.​
Command syntax​
​
Linux/macOS
Windows
​
  • Download an object using the authorization code​
​
./tosutil share-cp authorization_code|authorization_code_file_url file_url|folder_url [-key=xxx] [-dryRun] [-tempFileDir=xxx] [-u] [-vchecksum] [-p=1] [-threshold=104857600] [-ps=auto] [-cpd=xxx] [-versionId=xxx] [-fr] [-o=xxx] [-bt=xxx] [-e=xxx] [-re=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-conf=xxx]​
​
  • Batch download objects using the authorization code​
​
./tosutil share-cp authorization_code|authorization_code_file_url folder_url -r [-key=xxx] [-dryRun] [-tempFileDir=xxx] [-u] [-vchecksum] [-flat] [-j=1] [-p=1] [-threshold=104857600] [-ps=auto] [-cpd=xxx] [-include=*.xxx] [-exclude=*.xxx] [-timeRange=time1-time2] [-dmf] [-o=xxx] [-bt=xxx] [-e=xxx] [-re=xxx] [-i=xxx] [-k=xxx] [-t=xxx] [-conf=xxx]​
​
​
​
Parameters​
For descriptions of common optional parameters, see Global options.​
​
Parameter​
Type​
Description​
authorization_code​
String​
The authorization code to be used.​
file://authorization_code_file_url​
String​
The authorization code path to be used.​
file_url​
String​
The path for an object to be downloaded.​
folder_url​
String​
The path for the local folder where downloaded objects will be stored.​
-key​
String​
The name of the object to be downloaded or the prefix of the objects to be downloaded.​
-dryRun​
Bool​
Run in test mode without executing any actual downloads.​
-tempFileDir​
String​
The folder where temporary files generated during multipart downloads are stored. The default location is specified in the configuration file as defaultTempFileDir.​
tip​
  • If this parameter and the defaultTempFileDir parameter in the configuration file are both left blank, the temporary files will be stored in the same directory as the objects to be downloaded. These files will have names ending in .tos.temp.​
  • Since these temporary files will be saved in this directory, ensure that the user running tosutil has write permissions to this path. The available space in this directory must exceed the size of the objects to be downloaded.​
-u​
Bool​
This parameter is used for incremental downloads of objects. It compares the source and destination. We recommend using this setting in the following cases:​
  • The destination does not exist.​
  • The file size at the destination differs from that at the source.​
  • The last modified time at the destination is earlier than that at the source.​
-vchecksum​
Bool​
Validate data integrity during downloads using the CRC-64 algorithm.​
-flat​
Bool​
Do not include relative parent directories when downloading objects.​
-j​
Integer​
The maximum concurrency for batch operations. For example, setting -j=3 means that the maximum concurrency for batch operations is 3. This value is set to 3 by default, which is the defaultJobs value in the configuration file.​
-p​
Integer​
The maximum concurrency for a multipart task. For example, setting -p=1 means that the maximum concurrency for a multipart task is 1. This value is set to 1 by default, which is the defaultParallels value in the configuration file.​
-threshold​
Integer​
The limit, in bytes, for a multipart task. This value is set to the defaultBigfileThreshold value in the configuration file by default.​
tip​
This parameter supports configuration with capacity units. For example, there is no need to manually calculate how many bytes are in 1 MB—just write "1 MB," and the program will recognize it.​
-ps​
Integer/String​
The size, in bytes, of each part during a multipart task. This value is set to the defaultPartSize value in the configuration file by default.​
tip​
This parameter supports configuration with capacity units. For example, there is no need to manually calculate how many bytes are in 1 MB—just write "1 MB," and the program will recognize it.​
-cpd​
String​
The folder where checkpoint files are stored. The default location is specified in the configuration file as defaultCheckpointDir.​
-versionId​
String​
The version ID of an object to be downloaded.​
-include​
String​
The object matching pattern used to include objects for downloads. You can use the wildcards ? and * and the delimiter "#" in the match expression.​
-exclude​
String​
The object matching pattern used to exclude objects for downloads. You can use the wildcards ? and * and the delimiter "#" in the match expression.​
-timeRange​
String​
Sets the time range for the last modified time of objects during downloads, in the format of YYYYMMDDHHmmSS-YYYYMMDDHHmmSS.​
-dmf​
Bool​
Do not apply the parameters, -include/-exclude and -timeRange, to folders.​
-fr​
Bool​
Generate a result file when working with a single object.​
-o​
String​
The folder where result files are stored. The default location is specified in the configuration file as defaultOutputDir.​
-bt​
String​
The type of the bucket. The options are as follows:​
  • fns: A flat namespace (FNS) bucket.​
  • hns: A hierarchical namespace (HNS) bucket.​
tip​
If the bucket type is not specified, tosutil will obtain the bucket type from the bucket metadata by default when listing objects. However, it will not recognize the bucket type when listing directories. This may cause the request to fail or return an error.​
​
Examples​
Download an object​
Run the following command to download the object1.png object from the bucketname bucket to the /Users/Downloads/TOS/tosutil folder, using the authorization code path, /tmp/tosutil/authorization_code.​
  • Command​
  • ​
    ./tosutil share-cp file:///tmp/tosutil/authorization_code /Users/Downloads/TOS/tosutil -key=object1.png​
    ​
  • Output​
  • ​
    Start at 2022-10-27 10:56:20.611282 +0000 UTC​
    ​
    ​
    Parallel: 1 Jobs: 5 ​
    Threshold: 100.00MB PartSize: auto ​
    VerifyChecksum: false ​
    CheckpointDir: /Users/.tosutil_checkpoint​
    TempFileDir: /Users/​
    ​
    Waiting to prepare the temp file [93456].​
    ​
    [-----------------------------------------------------------------------------] 100.00% 201.47KB/s 55.98KB/55.98KB 306ms​
    Waiting to rename temporary file...​
    ​
    ​
    Download successfully, 55.98KB, n/a, tos://bucketname/object1.png --> /Downloads/TOS/tosutil/object1.png, cost [106], status [200], request id [5c81485a63d4b1d7635a63d4-ac17b21f-1oo0Ye-GO-cb-tos-bj]​
    The authorized prefix is empty, all the content of bucket can be accessed​
    ​
Batch download objects​
Run the following command to download objects with the object prefix from the bucketname bucket to the /Users/Downloads/TOS/tosutil folder, using the authorization code path, /tmp/tosutil/authorization_code.​
  • Command​
  • ​
    ./tosutil share-cp file:///tmp/tosutil/authorization_code /Users/Downloads/TOS/tosutil -key=object -r​
    ​
  • Output​
  • ​
    Start at 2022-10-27 10:56:35.434563 +0000 UTC​
    ​
    ​
    Parallel: 1 Jobs: 5 ​
    Threshold: 100.00MB PartSize: auto ​
    VerifyChecksum: false ​
    CheckpointDir: /Users/.tosutil_checkpoint​
    OutputDir: /Users/.tosutil_output​
    TempFileDir: /Users/ ​
    ​
    [----------------------] 100.00% tps:51.09 3.02MB/s 4/4 238.21KB/238.21KB 278ms​
    Succeed count is: 4 Failed count is: 0 ​
    Succeed bytes is: 238.21KB ​
    Metrics [max cost:216 ms, min cost:163 ms, average cost:191.50 ms, average tps:14.23]​
    ​
    Task id is: 0653482e-55e6-11ed-afb8-aa665a3c7f26​
    The authorized prefix is empty, all the content of bucket can be accessed​
    ​
​
Last updated: 2025.12.17 18:33:45