diff --git a/api/@ohos.resourceManager.d.ts b/api/@ohos.resourceManager.d.ts index 1e46a3749f02b48a2f33a0423ad65a76a693f4b8..258978388031bccc282f99ee03478c28fb0acb3e 100644 --- a/api/@ohos.resourceManager.d.ts +++ b/api/@ohos.resourceManager.d.ts @@ -14,6 +14,7 @@ */ import Context from './application/Context'; +import { RawFileDescriptor } from './global/rawFileDescriptor'; /** * Provides resource related APIs. @@ -425,6 +426,24 @@ export interface ResourceManager { */ getRawFile(path: string): Promise; + /** + * Obtains the raw file resource descriptor corresponding to the specified resource path in callback mode. + * + * @param path Indicates the resource relative path. + * @param callback Indicates the asynchronous callback used to return the raw file resource descriptor. + * @since 8 + */ + getRawFileDescriptor(path: string, callback: AsyncCallback); + + /** + * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. + * + * @param path Indicates the resource relative path. + * @return Returns the raw file resource descriptor corresponding to the specified resource path. + * @since 8 + */ + getRawFileDescriptor(path: string): Promise; + /** * Obtains release resourceManager. * diff --git a/api/global/rawFileDescriptor.d.ts b/api/global/rawFileDescriptor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a38315ff6ebe9bb905acc8be5c8b67b102700538 --- /dev/null +++ b/api/global/rawFileDescriptor.d.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 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. + */ + +/** + * Contains rawFile descriptor information. + * @name Contains rawFile descriptor information + * @since 8 + * @syscap SystemCapability.Global.ResourceManager + * + * @permission N/A + */ + export interface RawFileDescriptor { + /** + * rawfile descriptor + * + * @since 8 + */ + fd: number; + + /** + * the offset from where the raw file starts in the HAP + * + * @since 8 + */ + offset: number; + + /** + * the length of the raw file in the HAP + * + * @since 8 + */ + length: number; +}