Object metadata includes HTTP headers and user metadata. You can configure the metadata of an object when you upload the object to Object Storage Service (OSS). The metadata of an object is uploaded and downloaded together with the object.
- When you use packaging tools such as Webpack and Browserify, install OSS SDK for Browser.js by running the npm install ali-oss command.
- OSS SDK for Browser.js is usually used in browsers. To prevent your AccessKey pair
from being exposed, we recommend that you use a temporary access credential generated
by Security Token Service (STS) to access OSS.
For more information about how to set up STS, see Use a temporary access credential provided by STS to access OSS in OSS Developer Guide. You can call the AssumeRole operation or use STS SDKs for various programming languages to obtain a temporary access credential. For more information, see STS SDK overview. A temporary access credential contains a security token and a temporary AccessKey pair that consists of an AccessKey ID and an AccessKey secret.
The following code provides an example on how to specify object metadata during uploads and how to update and view object metadata after uploads:
- For more information about the complete sample code for object metadata management, visit GitHub.
- For more information about the operation that is called to configure or modify object metadata during uploads, see PutObject.
- For more information about the API operation that is called to view object metadata, see HeadObject.