openharmony 鸿蒙 js-apis-file-cloudsyncmanager

2026-08-25 浏览 (2)

@ohos.file.cloudSyncManager (Device-Cloud Sync Management)

The cloudSyncManager module provides APIs for managing device-cloud sync for applications. You can use the APIs to manage the full download state, the reason why the full download stops, and number of local and cloud files.

NOTE

The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import { cloudSyncManager } from '@kit.CoreFileKit';

DownloadStopReason20+

Enumerates the reasons why the full download stops. The default value is NO_STOP.

System capability: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager

NameValueDescription
NO_STOP0Downloading.
NETWORK_UNAVAILABLE1Downloading. Mobile network and Wi-Fi are unavailable.
LOCAL_STORAGE_FULL2Downloading. The device storage is full.
TEMPERATURE_LIMIT3Downloading. The device temperature exceeds the upper limit.
USER_STOPPED4Downloading. The user stops the download.
APP_UNLOAD5Downloading. The application is uninstalled.
OTHER_REASON6Downloading. The download stops due to other reasons, for example, the cloud server does not respond.

DownloadState20+

Enumerates the full download states.

System capability: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager

NameValueDescription
RUNNING0Downloading.
COMPLETED1Downloaded.
STOPPED2Downloading stopped.

DownloadProgress20+

Describes the full download progress.

System capability: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager

Properties

NameTypeRead-OnlyOptionalDescription
stateDownloadStateNoNoDownload state.
successfulCountnumberNoNoNumber of downloaded files. The value range is [0, INT32_MAX]. If the progress is abnormal, -1 is returned.
failedCountnumberNoNoNumber of files that fail to be downloaded. The value range is [0, INT32_MAX]. If the progress is abnormal, -1 is returned.
totalCountnumberNoNoTotal number of files to be downloaded. The value range is [0, INT32_MAX]. If the progress is abnormal, -1 is returned.
downloadedSizenumberNoNoSize of the downloaded data, in bytes. The value range is [0, INT64_MAX). If the progress is abnormal, INT64_MAX is returned.
totalSizenumberNoNoTotal size of the files to be downloaded, in bytes. The value range is [0, INT64_MAX). If the progress is abnormal, INT64_MAX is returned.
stopReasonDownloadStopReasonNoNoReason why the download stops.

CloudFileInfo20+

Represents the number and size of local and cloud files of an application.

System capability: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager

Properties

NameTypeRead-OnlyOptionalDescription
cloudFileCountnumberNoNoTotal number of cloud files that are not downloaded locally. The value range is [0, INT32_MAX].
cloudFileTotalSizenumberNoNoTotal size of cloud files that are not downloaded locally, in bytes. The value range is [0, INT64_MAX].
localFileCountnumberNoNoTotal number of local files that are not uploaded to the cloud. The value range is [0, INT32_MAX].
localFileTotalSizenumberNoNoTotal size of local files that are not uploaded to the cloud, in bytes. The value range is [0, INT64_MAX].
bothFileCountnumberNoNoTotal number of local files that have been uploaded to the cloud. The value range is [0, INT32_MAX].
bothFileTotalSizenumberNoNoTotal size of local files that have been uploaded to the cloud, in bytes. The value range is [0, INT64_MAX].

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-file-environment-sys

openharmony 鸿蒙 js-apis-file-fs

openharmony 鸿蒙 capi-clouddisk-clouddisk-pathinfo

openharmony 鸿蒙 capi-clouddisk-clouddisk-changesresult

openharmony 鸿蒙 capi-clouddisk-clouddisk-syncfolder

openharmony 鸿蒙 js-apis-fileShare

openharmony 鸿蒙 capi-fileio

openharmony 鸿蒙 js-apis-file-storage-statistics-sys

openharmony 鸿蒙 js-apis-file-environment

openharmony 鸿蒙 js-apis-file-trash-sys

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/RE4zcwTA