Upload client
The SDK provides an Upload client to upload files using predefined configurations to a Sitecore Content Hub instance. The currently supported configurations are:
-
Package import
-
Create asset
-
Update asset main file
-
Update asset alternative file
In the following code examples, the client variable refers to the ContentHubClient instance. When using the JavaScript SDK, you can choose your own variable name, but it is called client at instantiation in the documentation.
Upload and import a package from a local source
For example, the following snippet uploads and imports a package using the ImportPackageConfiguration:
Upload and create an asset from a remote source
For example, the following snippet uploads and creates a new asset using the AssetUploadConfiguration:
Upload and create an asset from a buffer source
For example, the following snippets upload and create a new asset using the AssetUploadConfiguration: