diff --git a/interfaces/kits/js/@ohos.fileAccess.d.ts b/interfaces/kits/js/@ohos.fileAccess.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2f41dcfd999ff89abc6200e901d83d0cfbe9127 --- /dev/null +++ b/interfaces/kits/js/@ohos.fileAccess.d.ts @@ -0,0 +1,130 @@ +/* +* 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. +*/ + +import {AsyncCallback, Callback} from "./basic"; + +/** + * Provides fileAccess APIs + * + * @since 9 + * @syscap SystemCapability.FileManagement.UserFileService + */ + +declare namespace fileAccess { + +/** + * Open File + * + * @since 9 + * @systemapi + */ +function openFile(sourceFileUri: string, mode: string): Promise; +function openFile(sourceFileUri: string, mode: string, callback: AsyncCallback): void; + +/** + * Create File + * + * @since 9 + * @systemapi + */ +function createFile(parentUri: string, displayName: string, newFileUri: string): Promise; +function createFile(parentUri: string, displayName: string, newFileUri: string, callback: AsyncCallback): void; + +/** + * Mkdir + * + * @since 9 + * @systemapi + */ +function mkdir(parentUri: string, displayName: string, newDirUri: string): Promise; +function mkdir(parentUri: string, displayName: string, newDirUri: string, callback: AsyncCallback): void; + +/** + * Delete + * + * @since 9 + * @systemapi + */ +function delete(selectFileUri: string): Promise; +function delete(selectFileUri: string, callback: AsyncCallback): void; + +/** + * Move + * + * @since 9 + * @systemapi + */ +function move(sourceFileUri: string, targetParentUri: string, newFileUri: string): Promise; +function move(sourceFileUri: string, targetParentUri: string, newFileUri: string, callback: AsyncCallback): void; + +/** + * Rename + * + * @since 9 + * @systemapi + */ +function rename(sourceFileUri: string, displayName: string, newFileUri: string): Promise; +function rename(sourceFileUri: string, displayName: string, newFileUri: string, callback: AsyncCallback): void; + +export interface UnorderedMap { + key : string; + value : string; +} + +/** + * Query + * + * @since 9 + * @systemapi + */ +function query(sourceFileUri: string): Promise>; +function query(sourceFileUri: string, callback: AsyncCallback>): void; + +export interface FileInfo { + uri : string; + name : string; + mode : string; + size : number; + mtime : number; + mimitype : string; +} + +/** + * Query Child File + * + * @since 9 + * @systemapi + */ +function queryChildFile(sourceFileUri: string): Promise>; +function queryChildFile(sourceFileUri: string, callback: AsyncCallback>): void; + +export interface DeviceInfo { + deviceId : string; + uri : string; + title : string; + flags : number; +} + +/** + * Get Roots + * + * @since 9 + * @systemapi + */ +function getRoots(): Promise>; +function getRoots(callback: AsyncCallback>): void; +} + +export default fileAccess; \ No newline at end of file