mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-23 15:20:17 +00:00
!13296 【FS】fs.access 能力扩展
Merge pull request !13296 from 刘昊天/access_ext
This commit is contained in:
commit
676b1572b7
64
api/@ohos.file.fs.d.ts
vendored
64
api/@ohos.file.fs.d.ts
vendored
@ -121,6 +121,7 @@ declare namespace fileIo {
|
||||
export { write };
|
||||
export { writeSync };
|
||||
export { AccessModeType };
|
||||
export { AccessFlagType };
|
||||
export { File };
|
||||
export { OpenMode };
|
||||
export { RandomAccessFile };
|
||||
@ -534,6 +535,29 @@ declare function access(path: string, mode?: AccessModeType): Promise<boolean>;
|
||||
*/
|
||||
declare function access(path: string, callback: AsyncCallback<boolean>): void;
|
||||
|
||||
/**
|
||||
* Access file.
|
||||
*
|
||||
* @param { string } path - file path that needs to be checked whether the calling process can access.
|
||||
* @param { AccessModeType } mode - accessibility mode.
|
||||
* @param { AccessFlagType } flag - accessibility flag.
|
||||
* @returns { Promise<boolean> } Returns the file is accessible or not in promise mode.
|
||||
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
||||
* <br>2.Incorrect parameter types.
|
||||
* @throws { BusinessError } 13900005 - I/O error
|
||||
* @throws { BusinessError } 13900011 - Out of memory
|
||||
* @throws { BusinessError } 13900012 - Permission denied
|
||||
* @throws { BusinessError } 13900013 - Bad address
|
||||
* @throws { BusinessError } 13900018 - Not a directory
|
||||
* @throws { BusinessError } 13900020 - Invalid argument
|
||||
* @throws { BusinessError } 13900023 - Text file busy
|
||||
* @throws { BusinessError } 13900030 - File name too long
|
||||
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
|
||||
* @syscap SystemCapability.FileManagement.File.FileIO
|
||||
* @since 12
|
||||
*/
|
||||
declare function access(path: string, mode: AccessModeType, flag: AccessFlagType): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Access file with sync interface.
|
||||
*
|
||||
@ -623,6 +647,29 @@ declare function access(path: string, callback: AsyncCallback<boolean>): void;
|
||||
*/
|
||||
declare function accessSync(path: string, mode?: AccessModeType): boolean;
|
||||
|
||||
/**
|
||||
* Access file with sync interface.
|
||||
*
|
||||
* @param { string } path - file path that needs to be checked whether the calling process can access.
|
||||
* @param { AccessModeType } mode - accessibility mode.
|
||||
* @param { AccessFlagType } flag - accessibility flag.
|
||||
* @returns { boolean } Returns the file is accessible or not.
|
||||
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
||||
* <br>2.Incorrect parameter types.
|
||||
* @throws { BusinessError } 13900005 - I/O error
|
||||
* @throws { BusinessError } 13900011 - Out of memory
|
||||
* @throws { BusinessError } 13900012 - Permission denied
|
||||
* @throws { BusinessError } 13900013 - Bad address
|
||||
* @throws { BusinessError } 13900018 - Not a directory
|
||||
* @throws { BusinessError } 13900020 - Invalid argument
|
||||
* @throws { BusinessError } 13900023 - Text file busy
|
||||
* @throws { BusinessError } 13900030 - File name too long
|
||||
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
|
||||
* @syscap SystemCapability.FileManagement.File.FileIO
|
||||
* @since 12
|
||||
*/
|
||||
declare function accessSync(path: string, mode: AccessModeType, flag: AccessFlagType): boolean;
|
||||
|
||||
/**
|
||||
* Close file or fd.
|
||||
*
|
||||
@ -8786,3 +8833,20 @@ declare enum AccessModeType {
|
||||
*/
|
||||
READ_WRITE = 6,
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of different types of access flag.
|
||||
*
|
||||
* @enum { number } access flag type
|
||||
* @syscap SystemCapability.FileManagement.File.FileIO
|
||||
* @since 12
|
||||
*/
|
||||
declare enum AccessFlagType {
|
||||
/**
|
||||
* Check if the file is on the local.
|
||||
*
|
||||
* @syscap SystemCapability.FileManagement.File.FileIO
|
||||
* @since 12
|
||||
*/
|
||||
LOCAL = 0,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user