Uploading and Downloading an OHPM Package on the Client
CodeArts Artifact can connect to local OHPM clients. You may upload your private packages from your local OHPM client to self-hosted repos and share them with others, who can download these OHPM packages through their clients.
OHPM Package
OpenHarmony Package Manager (OHPM) is an ArkTS package management tool. OHPM manages packages, which are stored and organized in the OHPM repository.
The OHPM package contains the Harmony Archive (HAR) package and Harmony Shared Package (HSP) package.
- HAR: Static shared package, which is reused in the build phase. It is mainly used as a second-party or third-party library for other applications to depend on. It includes resource files, *.so files, and metadata files.
- HSP: Dynamic shared package, which is reused in the running phase. It provides shared code and resources to improve code reusability and maintainability.
Constraints
The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.
Prerequisites
- The client tool is npm, and the dependency management tool is OHPM. You have installed node.js 16.x or later.
- You have created an OHPM repository.
- You have the Download/View permission on the current repository. For details about how to obtain this permission, see Configuring Repository Permissions.
Uploading an OHPM Package from the Client
- Access self-hosted repos using your Huawei Cloud account.
- Select the target OHPM repository from the self-hosted repo page and click Tutorial on the right of the page.
- In the displayed dialog box, download the ohpmrc file and rename it .ohpmrc.

- Copy the file to the user directory. The path is as follows:
- Linux: ~/.ohpmrc
- Windows: C:\Users\<UserName>\.ohpm\.ohpmrc
- Upload the OHPM package to the repository.
ohpm publish {file path}\{package name}- file path: path of the local OHPM package.
- package name: name of the local OHPM package.

Downloading an OHPM Package Using the Client
ohpm install {package name} package name: name parameter in the return value in 5, as shown in the following figure:

The following figure shows that the download is successful.

Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot