From 8dc961158d0792378af68ae01446565947968262 Mon Sep 17 00:00:00 2001 From: wangjianqiang Date: Sun, 24 Apr 2022 19:08:24 +0800 Subject: [PATCH 1/2] test Signed-off-by: wangjianqiang --- interfaces/kits/js/@ohos.fileAccess.d.ts | 69 ++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 interfaces/kits/js/@ohos.fileAccess.d.ts diff --git a/interfaces/kits/js/@ohos.fileAccess.d.ts b/interfaces/kits/js/@ohos.fileAccess.d.ts new file mode 100644 index 00000000..427465f2 --- /dev/null +++ b/interfaces/kits/js/@ohos.fileAccess.d.ts @@ -0,0 +1,69 @@ +/* +* 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"; + +declare namespace fileaccess { + +function OpenFile(sourceFileUri: string, mode: string): Promise; +function OpenFile(sourceFileUri: string, mode: string, callback: AsyncCallback): void; + +function CreateFile(parentUri: string, displayName: string, newFileUri: string): Promise; +function CreateFile(parentUri: string, displayName: string, newFileUri: string, callback: AsyncCallback): void; + +function Mkdir(parentUri: string, displayName: string, newDirUri: string): Promise; +function Mkdir(parentUri: string, displayName: string, newDirUri: string, callback: AsyncCallback): void; + +function Delete(selectFileUri: string): Promise; +function Delete(selectFileUri: string, callback: AsyncCallback): void; + +function Move(sourceFileUri: string, targetParentUri: string, newFileUri: string): Promise; +function Move(sourceFileUri: string, targetParentUri: string, newFileUri: string, callback: AsyncCallback): void; + +function Rename(sourceFileUri: string, displayName: string, newFileUri: string): Promise; +function Rename(sourceFileUri: string, displayName: string, newFileUri: string, callback: AsyncCallback): void; + +export interface uMap { + key : string; + value : string; +} + +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; +} + +function QueryChildFile(sourceFileUri: string): Promise>; +function QueryChildFile(sourceFileUri: string, callback: AsyncCallback>): void; + +export interface deviceInfo { + deviceId : string; + uri : string; + title : string; + flags : number; +} + +function GetRoots(): Promise>; +function GetRoots(callback: AsyncCallback>): void; +} + +export default fileaccess; \ No newline at end of file -- Gitee From fc825bbd3ca9ab7ac7c8636cb8976b592f199f8f Mon Sep 17 00:00:00 2001 From: wangjianqiang Date: Sun, 24 Apr 2022 19:10:38 +0800 Subject: [PATCH 2/2] test Signed-off-by: wangjianqiang --- interfaces/kits/js/@ohos.fileAccess.d.ts | 109 ++++++++++++++++++----- 1 file changed, 85 insertions(+), 24 deletions(-) diff --git a/interfaces/kits/js/@ohos.fileAccess.d.ts b/interfaces/kits/js/@ohos.fileAccess.d.ts index 427465f2..e2f41dcf 100644 --- a/interfaces/kits/js/@ohos.fileAccess.d.ts +++ b/interfaces/kits/js/@ohos.fileAccess.d.ts @@ -15,35 +15,84 @@ import {AsyncCallback, Callback} from "./basic"; -declare namespace fileaccess { +/** + * Provides fileAccess APIs + * + * @since 9 + * @syscap SystemCapability.FileManagement.UserFileService + */ -function OpenFile(sourceFileUri: string, mode: string): Promise; -function OpenFile(sourceFileUri: string, mode: string, callback: AsyncCallback): void; +declare namespace fileAccess { -function CreateFile(parentUri: string, displayName: string, newFileUri: string): Promise; -function CreateFile(parentUri: string, displayName: string, newFileUri: string, callback: AsyncCallback): void; +/** + * Open File + * + * @since 9 + * @systemapi + */ +function openFile(sourceFileUri: string, mode: string): Promise; +function openFile(sourceFileUri: string, mode: string, callback: AsyncCallback): void; -function Mkdir(parentUri: string, displayName: string, newDirUri: string): Promise; -function Mkdir(parentUri: string, displayName: string, newDirUri: 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; -function Delete(selectFileUri: string): Promise; -function Delete(selectFileUri: 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; -function Move(sourceFileUri: string, targetParentUri: string, newFileUri: string): Promise; -function Move(sourceFileUri: string, targetParentUri: string, newFileUri: string, callback: AsyncCallback): void; +/** + * Delete + * + * @since 9 + * @systemapi + */ +function delete(selectFileUri: string): Promise; +function delete(selectFileUri: string, callback: AsyncCallback): void; -function Rename(sourceFileUri: string, displayName: string, newFileUri: string): Promise; -function Rename(sourceFileUri: string, displayName: string, newFileUri: 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; -export interface uMap { +/** + * 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; } -function Query(sourceFileUri: string): Promise>; -function Query(sourceFileUri: string, callback: AsyncCallback>): void; +/** + * Query + * + * @since 9 + * @systemapi + */ +function query(sourceFileUri: string): Promise>; +function query(sourceFileUri: string, callback: AsyncCallback>): void; -export interface fileInfo { +export interface FileInfo { uri : string; name : string; mode : string; @@ -52,18 +101,30 @@ export interface fileInfo { mimitype : string; } -function QueryChildFile(sourceFileUri: string): Promise>; -function QueryChildFile(sourceFileUri: string, callback: AsyncCallback>): void; +/** + * Query Child File + * + * @since 9 + * @systemapi + */ +function queryChildFile(sourceFileUri: string): Promise>; +function queryChildFile(sourceFileUri: string, callback: AsyncCallback>): void; -export interface deviceInfo { +export interface DeviceInfo { deviceId : string; uri : string; title : string; flags : number; } - -function GetRoots(): Promise>; -function GetRoots(callback: AsyncCallback>): void; + +/** + * Get Roots + * + * @since 9 + * @systemapi + */ +function getRoots(): Promise>; +function getRoots(callback: AsyncCallback>): void; } -export default fileaccess; \ No newline at end of file +export default fileAccess; \ No newline at end of file -- Gitee