Signed-off-by: 18721213663 <zhuhongtao12@huawei.com>
This commit is contained in:
18721213663 2023-08-26 17:38:23 +08:00
parent 440673c28d
commit ad266688f1
3 changed files with 139 additions and 0 deletions

View File

@ -38,6 +38,7 @@ declare namespace fileIo {
export { close };
export { closeSync };
export { copyDir };
export { copyDirSync };
export { copyFile };
export { copyFileSync };
export { createRandomAccessFile };
@ -61,6 +62,7 @@ declare namespace fileIo {
export { mkdtemp };
export { mkdtempSync };
export { moveDir };
export { moveDirSync };
export { moveFile };
export { moveFileSync };
export { open };
@ -601,6 +603,35 @@ declare function copyDir(src: string, dest: string, mode: number, callback: Asyn
*/
declare function copyDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void;
/**
* Copy directory with sync interface.
*
* @param { string } src - source path.
* @param { string } dest - destination path.
* @param { number } [mode = 0] - mode.
* @throws { BusinessError } 13900002 - No such file or directory
* @throws { BusinessError } 13900004 - Interrupted system call
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900008 - Bad file descriptor
* @throws { BusinessError } 13900010 - Try again
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900013 - Bad address
* @throws { BusinessError } 13900015 - File exists
* @throws { BusinessError } 13900018 - Not a directory
* @throws { BusinessError } 13900019 - Is a directory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900030 - File name too long
* @throws { BusinessError } 13900031 - Function not implemented
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
* @throws { BusinessError } 13900034 - Operation would block
* @throws { BusinessError } 13900038 - Value too large for defined data type
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 10
*/
declare function copyDirSync(src: string, dest: string, mode?: number): void;
/**
* Copy file.
*
@ -2056,6 +2087,36 @@ declare function moveDir(src: string, dest: string, mode: number, callback: Asyn
*/
declare function moveDir(src: string, dest: string, mode: number, callback: AsyncCallback<void, Array<ConflictFiles>>): void;
/**
* Move directory with sync interface.
*
* @param { string } src - source file path.
* @param { string } dest - destination file path.
* @param { number } [mode = 0] - move mode when duplicate file name exists.
* @throws { BusinessError } 13900001 - Operation not permitted
* @throws { BusinessError } 13900002 - No such file or directory
* @throws { BusinessError } 13900008 - Bad file descriptor
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900013 - Bad address
* @throws { BusinessError } 13900014 - Device or resource busy
* @throws { BusinessError } 13900015 - File exists
* @throws { BusinessError } 13900016 - Cross-device link
* @throws { BusinessError } 13900018 - Not a directory
* @throws { BusinessError } 13900019 - Is a directory
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900025 - No space left on device
* @throws { BusinessError } 13900027 - Read-only file system
* @throws { BusinessError } 13900028 - Too many links
* @throws { BusinessError } 13900032 - Directory not empty
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
* @throws { BusinessError } 13900041 - Quota exceeded
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 10
*/
declare function moveDirSync(src: string, dest: string, mode?: number): void;
/**
* Move file.
*

View File

@ -69,6 +69,29 @@ declare namespace statfs {
*/
function getFreeSize(path: string, callback: AsyncCallback<number>): void;
/**
* Get the number of free bytes on the specified path with sync interface.
*
* @param { string } path - path
* @returns { number } return the number of free bytes on the specified path
* @throws { BusinessError } 13900002 - No such file or directory
* @throws { BusinessError } 13900004 - Interrupted system call
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900008 - Bad file descriptor
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900013 - Bad address
* @throws { BusinessError } 13900018 - Not a directory
* @throws { BusinessError } 13900030 - File name too long
* @throws { BusinessError } 13900031 - Function not implemented
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
* @throws { BusinessError } 13900038 - Value too large for defined data type
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 10
*/
function getFreeSizeSync(path: string): number;
/**
* Get the number of total bytes on the specified path.
*
@ -114,6 +137,29 @@ declare namespace statfs {
* @since 9
*/
function getTotalSize(path: string, callback: AsyncCallback<number>): void;
/**
* Get the number of total bytes on the specified path with sync interface.
*
* @param { string } path - path
* @returns { number } return the number of total bytes
* @throws { BusinessError } 13900002 - No such file or directory
* @throws { BusinessError } 13900004 - Interrupted system call
* @throws { BusinessError } 13900005 - I/O error
* @throws { BusinessError } 13900008 - Bad file descriptor
* @throws { BusinessError } 13900011 - Out of memory
* @throws { BusinessError } 13900012 - Permission denied
* @throws { BusinessError } 13900013 - Bad address
* @throws { BusinessError } 13900018 - Not a directory
* @throws { BusinessError } 13900030 - File name too long
* @throws { BusinessError } 13900031 - Function not implemented
* @throws { BusinessError } 13900033 - Too many symbolic links encountered
* @throws { BusinessError } 13900038 - Value too large for defined data type
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 10
*/
function getTotalSizeSync(path: string): number;
}
export default statfs;

View File

@ -382,6 +382,22 @@ declare namespace storageStatistics {
*/
function getTotalSize(): Promise<number>;
/**
* Get the total size with sync interface
*
* @permission ohos.permission.STORAGE_MANAGER
* @returns { number } return the total size
* @throws { BusinessError } 201 - Permission verification failed.
* @throws { BusinessError } 202 - The caller is not a system application.
* @throws { BusinessError } 401 - The input parameter is invalid.
* @throws { BusinessError } 13600001 - IPC error.
* @throws { BusinessError } 13900042 - Unknown error.
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
* @systemapi
* @since 10
*/
function getTotalSizeSync(): number;
/**
* Get the freesize
*
@ -413,6 +429,22 @@ declare namespace storageStatistics {
* @since 9
*/
function getFreeSize(): Promise<number>;
/**
* Get the free size with sync interface
*
* @permission ohos.permission.STORAGE_MANAGER
* @returns { number } return the free size
* @throws { BusinessError } 201 - Permission verification failed.
* @throws { BusinessError } 202 - The caller is not a system application.
* @throws { BusinessError } 401 - The input parameter is invalid.
* @throws { BusinessError } 13600001 - IPC error.
* @throws { BusinessError } 13900042 - Unknown error.
* @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics
* @systemapi
* @since 10
*/
function getFreeSizeSync(): number;
}
export default storageStatistics;