From 33afdaed0e742928283030f54cb879e1f4d5483e Mon Sep 17 00:00:00 2001 From: wanghang <408861745@qq.com> Date: Thu, 26 May 2022 15:24:18 +0800 Subject: [PATCH] IssueNo:#I59CXF:fix bundle doc Description:fix bundle doc Sig:SIG_ApplicaitonFramework Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wanghang <408861745@qq.com> --- .../reference/apis/js-apis-Bundle.md | 67 +++++++++++++++++++ .../apis/js-apis-bundle-ApplicationInfo.md | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index 43a69fa050..bc4bde950e 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -493,6 +493,73 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => { }) ``` +## bundle.getBundleArchiveInfo + +getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise + +以异步方法获取有关HAP包中包含的应用程序包的信息,使用Promise形式返回结果。 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------ | +| hapFilePath | string | 是 | HAP存放路径。路径应指向当前应用程序的数据目录的相对目录。 | +| bundleFlags | number | 是 | 用于指定要返回的BundleInfo对象中包含信息的标记。默认值:0,取值范围:大于0。 | + +**返回值:** +| 类型 | 说明 | +| -------------- | -------------------------------------- | +| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | 返回值为Promise对象,Promise中包含有关hap包中包含的应用程序的信息。 | + +**示例:** + +```js +let hapFilePath = "/data/xxx/test.hap"; +let bundleFlags = 0; +bundle.getBundleArchiveInfo(hapFilePath, bundleFlags) +.then((data) => { + console.info('Operation successful. Data: ' + JSON.stringify(data)); +}).catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); +}) +``` + +## bundle.getBundleArchiveInfo + +getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void + +以异步方法获取有关HAP包中包含的应用程序包的信息,使用callback形式返回结果。 + +**系统能力:** + +SystemCapability.BundleManager.BundleFramework + +**参数:** + +| 名称 | 类型 | 必填 | 描述 | +| ---------- | ------ | ---- | ------------ | +| hapFilePath | string | 是 | HAP存放路径。路径应指向当前应用程序的数据目录的相对目录。 | +| bundleFlags | number | 是 | 用于指定要返回的BundleInfo对象中包含信息的标记。默认值:0,取值范围:大于0。 | +| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | 是 | 用于指定要返回的BundleInfo对象中包含信息的标记。默认值:0,取值范围:大于0。 | + +**示例:** + +```js +let hapFilePath = "/data/xxx/test.hap"; +let bundleFlags = 0; +bundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => { + if (err) { + console.error('Operation failed. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Operation successful. Data:' + JSON.stringify(data)); +}) +``` + ## bundle.getAbilityInfo getAbilityInfo(bundleName: string, abilityName: string): Promise\ diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md index e41a3b533c..2f47533470 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md @@ -31,4 +31,4 @@ | removable8+ | boolean | 是 | 否 | 应用程序是否可以被移除 | | accessTokenId8+ | number | 是 | 否 | 应用程序的accessTokenId | | uid8+ | number | 是 | 否 | 应用程序的uid | -| entityType9+ | string | 是 | 否 | 应用程序的实体类型 | +| entityType8+ | string | 是 | 否 | 应用程序的实体类型 | -- GitLab