The current repo belongs to Closed status, and some functions are restricted. For details, please refer to the description of repo status
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
Closed

Create your Gitee Account
Explore and code with more than 13.5 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
@ohos.file.backup.d.ts 49.69 KB
Copy Edit Raw Blame History
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109
/*
* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit CoreFileKit
*/
import type { AsyncCallback, Callback } from './@ohos.base';
/**
* Module providing backup and restore capabilities.
*
* @namespace backup
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
declare namespace backup {
/**
* Corresponding to a file's metadata. FileMeta is useful when doing IPC with the backup service.
*
* @interface FileMeta
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
interface FileMeta {
/**
* Indicates the name of a bundle.
*
* @type { string }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
bundleName: string;
/**
* Indicates a uri to a file.
*
* @type { string }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
uri: string;
}
/**
* Corresponding to a file's data. Filedata is useful when doing IPC with the backup service.
*
* @interface FileData
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
interface FileData {
/**
* Indicates a native file descriptor typically retrieved from the backup service to hold the file's content.
*
* @type { number }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
fd: number;
}
/**
* Save the time information of the incremental backup. IncrementalBackupTime is useful when doing IPC with the backup service.
*
* @interface IncrementalBackupTime
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface IncrementalBackupTime {
/**
* Indicates the name of a bundle.
*
* @type { string }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
bundleName: string;
/**
* Time of the last incremental backup
*
* @type { number }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
lastIncrementalTime: number;
}
/**
* Manifest file information in incremental data. FileManifestData is useful when doing IPC with the backup service.
*
* @interface FileManifestData
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface FileManifestData {
/**
* A file descriptor for the manifest file that holds the data
*
* @type { number }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
manifestFd: number;
}
/**
* Provides configuration parameters for backup and restore.
*
* @interface BackupParams
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface BackupParams {
/**
* The optional parameters a json strings in the form of key value in backup or restore.
*
* @type { ?string }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
parameters?: string;
}
/**
* Control backup and restore priority sequence
*
* @interface BackupPriority
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface BackupPriority {
/**
* Indicates the priority of a bundle.
*
* @type { ?number }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
priority?: number;
}
/**
* Corresponds to an incremental application, including its last incremental time and incremental list.
*
* @extends IncrementalBackupTime, FileManifestData, BackupParams, BackupPriority
* @interface IncrementalBackupData
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface IncrementalBackupData extends IncrementalBackupTime, FileManifestData, BackupParams, BackupPriority {}
/**
* Corresponding to a file, including its metadata and data.
* File is useful when doing IPC with the backup service.
*
* @extends FileMeta, FileData, FileManifestData
* @interface File
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
/**
* Corresponds to a file, including its metadata and data and the file's manifest data.
* Files are useful as IPC and backup services.
*
* @extends FileMeta, FileData, FileManifestData
* @interface File
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
interface File extends FileMeta, FileData, FileManifestData {}
/**
* Obtain the backupVersion.
*
* @permission ohos.permission.BACKUP
* @returns { string } Return the backupVersion.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
function getBackupVersion(): string;
/**
* Obtain a Json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @returns { Promise<FileData> } A FileData holding all the local capabilities. The returned file is a temporal file that will be
* deleted automatically when closed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
function getLocalCapabilities(): Promise<FileData>;
/**
* Obtain a Json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @param { AsyncCallback<FileData> } callback A callback method, the argument FileData will holding all the local capabilities.
* The returned file is a temporal file that will be deleted automatically when closed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
function getLocalCapabilities(callback: AsyncCallback<FileData>): void;
/**
* Obtain a json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @param { Array<IncrementalBackupTime> } dataList
* @returns { Promise<FileData> } A FileData holding all the local capabilities. The returned file is a temporal file that will be
* deleted automatically when closed.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
function getLocalCapabilities(dataList: Array<IncrementalBackupTime>): Promise<FileData>;
/**
* Get Backup information from bundle.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleToBackup Bundle to backup.
* @returns { string } Return the backup application's info.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
function getBackupInfo(bundleToBackup: string): string;
/**
* Update backup or restore timeout.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName set update to bundleName app.
* @param { number } timeout Update backup or restore timeout(unit:ms).
* @returns { boolean } Return update result, true is success, false is fail.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
function updateTimer(bundleName: string, timeout: number): boolean;
/**
* Update send file fd rate.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName set update to bundleName app.
* @param { number } sendRate set send file fd rate.
* @returns { boolean } Return update result, true is success, false is fail.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
function updateSendRate(bundleName: string, sendRate: number): boolean;
/**
* function that returns backup datasize by bundleName.
*
* @typedef {function} OnBackupSizeReport
* @param {string} reportInfo -the scanned backup datasize infos.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
type OnBackupSizeReport = (reportInfo: string) => void;
/**
* General callbacks for both backup and restore procedure.
* The backup service will notify the client by these callbacks.
*
* @interface GeneralCallbacks
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
interface GeneralCallbacks {
/**
* Callback called when the backup service tries to send files to the client.
* The File argument indicates a file to send to the client.
* The returned file is owned by the backup service and will be cleaned by the service once the file is closed.
*
* @type { AsyncCallback<File> }
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
onFileReady: AsyncCallback<File>;
/**
* Callback called when a backup/restore procedure for an bundle is started.
* The return string argument indicates the name of the bundle.
*
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
/**
* Callback called when a backup/restore procedure for an bundle is started.
* The first return string parameter indicates the name of the bundle.
* The second return string parameter indicates that when BusinessError errors occur,
* the callback data is the name of the bundle.
*
* @type { AsyncCallback<string, void | string> }
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13500001 - The application is not added to the backup or restore
* @throws { BusinessError } 13500002 - Failed to start application extension Procedure
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
onBundleBegin: AsyncCallback<string, void | string>;
/**
* Callback called when a backup/restore procedure for an bundle ends successfully or gets aborted unexpectedly.
* The return string argument indicates the name of the bundle.
*
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
/**
* Callback called when a backup/restore procedure for an bundle ends successfully or gets aborted unexpectedly.
* The first return string parameter indicates the name of the bundle.
* The second return string parameter indicates that when BusinessError errors occur,
* the callback data is the name of the bundle.
*
* @type { AsyncCallback<string, void | string> }
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13500003 - Backup or restore timed out
* @throws { BusinessError } 13500004 - Application extension death
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
onBundleEnd: AsyncCallback<string, void | string>;
/**
* Callback called when the all the bundles to backup/restore are done or aborted unexpectedly.
*
* @type { AsyncCallback<undefined> }
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
onAllBundlesEnd: AsyncCallback<undefined>;
/**
* Callback called when the backup service dies unexpectedly.
*
* @type { Callback<undefined> }
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
onBackupServiceDied: Callback<undefined>;
/**
* Callback called when the backup service return result information.
* The first return string parameter indicates the bundleName that triggers the callback.
* The second return string parameter indicates the result of the bundle.
*
* @param { string } bundleName the bundleName that triggers the callback.
* @param { string } result the result of the bundle.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
onResultReport(bundleName: string, result: string);
/**
* Callback called when the backup_sa service return result information.
* The first return string parameter indicates the result of the bundle.
*
* @param { string } bundleName the bundleName that triggers the callback.
* @param { string } process the process info of the bundle.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13500006 - Tar error
* @throws { BusinessError } 13500008 - Untar error
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
onProcess(bundleName: string, process: string);
/**
* Callback called when the backup_sa service return result information.
* The first return string parameter indicates the result of the scanned bundle datasize.
*
* @type {OnBackupSizeReport}.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
onBackupSizeReport?: OnBackupSizeReport;
}
/**
* Control class for backup procedure.
*
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
class SessionBackup {
/**
* Constructor for obtaining the instance of the SessionBackup class.
*
* @permission ohos.permission.BACKUP
* @param { GeneralCallbacks } callbacks Callbacks to be registered for the backup.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
constructor(callbacks: GeneralCallbacks);
/**
* Obtain a Json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @returns { Promise<FileData> } A FileData holding all the local capabilities. The returned file is a temporal file that will be
* deleted automatically when closed.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Internal error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
getLocalCapabilities(): Promise<FileData>;
/**
* Obtain application data size to be backed up.
*
* @permission ohos.permission.BACKUP
* @param { boolean } isPreciseScan Indicates whether to obtain the exact data size.
* @param { Array<IncrementalBackupTime> } dataList Application list.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Internal error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
getBackupDataSize(isPreciseScan: boolean, dataList: Array<IncrementalBackupTime>): Promise<void>;
/**
* Append new bundles to backup.
*
* @permission ohos.permission.BACKUP
* @param { string[] } bundlesToBackup Bundles to backup.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
/**
* Append new bundles and backupInfos to backup.
*
* @permission ohos.permission.BACKUP
* @param { string[] } bundlesToBackup Bundles to backup.
* @param { string[] } infos Infos to backup.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
appendBundles(bundlesToBackup: string[], infos?: string[]): Promise<void>;
/**
* Append new bundles to backup.
*
* @permission ohos.permission.BACKUP
* @param { string[] } bundlesToBackup Bundles to backup.
* @param { AsyncCallback<void> } callback Asynchronous callback to be called when appendBundles has finished.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
appendBundles(bundlesToBackup: string[], callback: AsyncCallback<void>): void;
/**
* End Backup process
*
* @permission ohos.permission.BACKUP
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
release(): Promise<void>;
/**
* cancel the application being backup.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be canceled.
* @returns { number } Return cancel result, 0 is success, 13500011 is fail, 13500012 is not have task.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
cancel(bundleName: string): number;
/**
* Provides an interface for the tool to clear temporary directories
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be cleaned.
* @returns { Promise<boolean> } Return clean result, true is success, false is fail.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
cleanBundleTempDir(bundleName: string): Promise<boolean>;
/**
* Provides an interface for the tool to get compatibility info.
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application that need to get compatibilityInfo.
* @param { string } extInfo - Indicates the extension information of application.
* @returns { Promise<string> } Return compatibility info.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed,
* application which is not a system application uses system API.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
getCompatibilityInfo(bundleName: string, extInfo: string): Promise<string>;
}
/**
* Control class for restore procedure.
*
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
class SessionRestore {
/**
* Constructor for obtaining the instance of the SessionBackup class.
*
* @permission ohos.permission.BACKUP
* @param { GeneralCallbacks } callbacks Callbacks to be registered for the restore.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
constructor(callbacks: GeneralCallbacks);
/**
* Obtain a Json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @returns { Promise<FileData> } A FileData holding all the local capabilities. The returned file is a temporal file that will be
* deleted automatically when closed.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Internal error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
getLocalCapabilities(): Promise<FileData>;
/**
* Append new bundles to be restore up during the restore.
*
* @permission ohos.permission.BACKUP
* @param { number } remoteCapabilitiesFd Opened JSON file that stores remote device capabilities.
* You can use the getLocalCapabilities method to obtain the value.
* @param { string[] } bundlesToBackup Bundles to restore.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
/**
* Append new bundles and restoreInfos to be restore up during the restore.
*
* @permission ohos.permission.BACKUP
* @param { number } remoteCapabilitiesFd Opened JSON file that stores remote device capabilities.
* You can use the getLocalCapabilities method to obtain the value.
* @param { string[] } bundlesToBackup Bundles to restore.
* @param { string[] } [infos] infos to restore
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
appendBundles(remoteCapabilitiesFd: number, bundlesToBackup: string[], infos?: string[]): Promise<void>;
/**
* Append new bundles to be restore up during the restore.
*
* @permission ohos.permission.BACKUP
* @param { number } remoteCapabilitiesFd Opened JSON file that stores remote device capabilities.
* You can use the getLocalCapabilities method to obtain the value.
* @param { string[] } bundlesToBackup Bundles to restore.
* @param { AsyncCallback<void> } callback Asynchronous callback to be called when appendBundles has finished.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
appendBundles(remoteCapabilitiesFd: number, bundlesToBackup: string[], callback: AsyncCallback<void>): void;
/**
* Publish the file handle to the backup service to make the service aware that the file's content is ready.
* This interface is part of the zero-copy feature.
*
* @permission ohos.permission.BACKUP
* @param { FileMeta } fileMeta Metadata of the file to be sent. Make sure that the backup framework holds
* this file by calling getFileHandle.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
publishFile(fileMeta: FileMeta): Promise<void>;
/**
* Publish the file handle to the backup service to make the service aware that the file's content is ready.
* This interface is part of the zero-copy feature.
*
* @permission ohos.permission.BACKUP
* @param { FileMeta } fileMeta Metadata of the file to be sent. Make sure that the backup framework holds
* this file by calling getFileHandle.
* @param { AsyncCallback<void> } callback Asynchronous callback to be called when publishFile has finished.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
publishFile(fileMeta: FileMeta, callback: AsyncCallback<void>): void;
/**
* Request to get a shared file from the service. This interface is part of the zero-copy feature.
* Developers could get the file through onFileReady callback.
* When the client accomplished the file, use publishFile to publish.
*
* @permission ohos.permission.BACKUP
* @param { FileMeta } fileMeta Metadata of the file to be sent. Note that all the files should come
* from the backup procedure or the getLocalCapabilities method.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
getFileHandle(fileMeta: FileMeta): Promise<void>;
/**
* Request to get a shared file from the service. This interface is part of the zero-copy feature.
* Developers could get the file through onFileReady callback.
* When the client accomplished the file, use publishFile to publish.
*
* @permission ohos.permission.BACKUP
* @param { FileMeta } fileMeta Metadata of the file to be sent. Note that all the files should come
* from the backup procedure or the getLocalCapabilities method.
* @param { AsyncCallback<void> } callback Asynchronous callback to be called when getFileHandle has finished.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 10
*/
getFileHandle(fileMeta: FileMeta, callback: AsyncCallback<void>): void;
/**
* End restore process
*
* @permission ohos.permission.BACKUP
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
release(): Promise<void>;
/**
* cancel the application being restore.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be canceled.
* @returns { number } Return cancel result, 0 is success, 13500011 is fail, 13500012 is not have task.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
cancel(bundleName: string): number;
/**
* Provides an interface for the tool to clear temporary directories
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be cleaned.
* @returns { Promise<boolean> } Return clean result, true is success, false is fail.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
cleanBundleTempDir(bundleName: string): Promise<boolean>;
/**
* Provides an interface for the tool to get compatibility info.
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application that need to get compatibilityInfo.
* @param { string } extInfo - Indicates the extension information of application.
* @returns { Promise<string> } Return compatibility info.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed,
* application which is not a system application uses system API.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
getCompatibilityInfo(bundleName: string, extInfo: string): Promise<string>;
}
/**
* Control class for incremental backup procedure.
*
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
class IncrementalBackupSession {
/**
* Constructor for obtaining the instance of the IncrementalBackupSession class.
*
* @permission ohos.permission.BACKUP
* @param { GeneralCallbacks } callbacks Callbacks to be registered for the backup.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
constructor(callbacks: GeneralCallbacks);
/**
* Obtain a Json file that describes local capabilities.
*
* @permission ohos.permission.BACKUP
* @returns { Promise<FileData> } A FileData holding all the local capabilities. The returned file is a temporal file that will be
* deleted automatically when closed.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Internal error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
getLocalCapabilities(): Promise<FileData>;
/**
* Obtain application data size to be backed up.
*
* @permission ohos.permission.BACKUP
* @param { boolean } isPreciseScan Indicates whether to obtain the exact data size.
* @param { Array<IncrementalBackupTime> } dataList Application list.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Internal error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
getBackupDataSize(isPreciseScan: boolean, dataList: Array<IncrementalBackupTime>): Promise<void>;
/**
* Append new bundles to incremental backup.
*
* @permission ohos.permission.BACKUP
* @param { Array<IncrementalBackupData> } bundlesToBackup Bundles to incremental backup.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
appendBundles(bundlesToBackup: Array<IncrementalBackupData>): Promise<void>;
/**
* Append new bundles to incremental backup.
*
* @permission ohos.permission.BACKUP
* @param { Array<IncrementalBackupData> } bundlesToAppend Bundles to incremental backup.
* @param { string[] } infos information of the bundlesToBackup
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed. This error code is usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
appendBundles(bundlesToAppend: Array<IncrementalBackupData>, infos: string[]): Promise<void>;
/**
* End backup process
*
* @permission ohos.permission.BACKUP
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @throws { BusinessError } 13600001 - IPC error
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 12
*/
release(): Promise<void>;
/**
* cancel the application being incrementalBackup.
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be canceled.
* @returns { number } Return cancel result, 0 is success, 13500011 is fail, 13500012 is not have task.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 18
*/
cancel(bundleName: string): number;
/**
* Provides an interface for the tool to clear temporary directories
*
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application to be cleaned.
* @returns { Promise<boolean> } Return clean result, true is success, false is fail.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
* <br>2. Incorrect parameter types. 3.Parameter verification failed.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
cleanBundleTempDir(bundleName: string): Promise<boolean>;
/**
* Provides an interface for the tool to get compatibility info.
* @permission ohos.permission.BACKUP
* @param { string } bundleName - Set the bundleName of the application that need to get compatibilityInfo.
* @param { string } extInfo - Indicates the extension information of application.
* @returns { Promise<string> } Return compatibility info.
* @throws { BusinessError } 201 - Permission verification failed, usually the result returned by VerifyAccessToken.
* @throws { BusinessError } 202 - Permission verification failed,
* application which is not a system application uses system API.
* @syscap SystemCapability.FileManagement.StorageService.Backup
* @systemapi
* @since 20
*/
getCompatibilityInfo(bundleName: string, extInfo: string): Promise<string>;
}
}
export default backup;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

Search