From 5a8a472b68b8ab537c8457224e0151c9b681c91b Mon Sep 17 00:00:00 2001 From: wplan1 Date: Thu, 17 Feb 2022 17:15:40 +0800 Subject: [PATCH] add getRawfileFd Signed-off-by: wplan1 --- api/@ohos.resourceManager.d.ts | 19 +++++++++++++ api/global/rawFileDescriptor.d.ts | 45 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 api/global/rawFileDescriptor.d.ts diff --git a/api/@ohos.resourceManager.d.ts b/api/@ohos.resourceManager.d.ts index 1e46a3749f..2589783880 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 0000000000..a38315ff6e --- /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; +} -- Gitee