161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (C) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit CoreFileKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Provides filesystem statistics APIs 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace statfs 2761847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 2861847f8eSopenharmony_ci * @since 9 2961847f8eSopenharmony_ci */ 3061847f8eSopenharmony_cideclare namespace statfs { 3161847f8eSopenharmony_ci /** 3261847f8eSopenharmony_ci * Get the number of free bytes on the specified path. 3361847f8eSopenharmony_ci * 3461847f8eSopenharmony_ci * @param { string } path - path 3561847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 3661847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 3761847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 3861847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 3961847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 4061847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 4161847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 4261847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 4361847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 4461847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 4561847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 4661847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 4761847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 4861847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 4961847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 5061847f8eSopenharmony_ci * @since 9 5161847f8eSopenharmony_ci */ 5261847f8eSopenharmony_ci function getFreeSize(path: string): Promise<number>; 5361847f8eSopenharmony_ci 5461847f8eSopenharmony_ci /** 5561847f8eSopenharmony_ci * Get the number of free bytes on the specified path. 5661847f8eSopenharmony_ci * 5761847f8eSopenharmony_ci * @param { string } path - path 5861847f8eSopenharmony_ci * @param { AsyncCallback<number> } [callback] - callback 5961847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 6061847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 6161847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 6261847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 6361847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 6461847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 6561847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 6661847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 6761847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 6861847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 6961847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 7061847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 7161847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 7261847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 7361847f8eSopenharmony_ci * @since 9 7461847f8eSopenharmony_ci */ 7561847f8eSopenharmony_ci function getFreeSize(path: string, callback: AsyncCallback<number>): void; 7661847f8eSopenharmony_ci 7761847f8eSopenharmony_ci /** 7861847f8eSopenharmony_ci * Get the number of free bytes on the specified path with sync interface. 7961847f8eSopenharmony_ci * 8061847f8eSopenharmony_ci * @param { string } path - path 8161847f8eSopenharmony_ci * @returns { number } return the number of free bytes on the specified path 8261847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 8361847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 8461847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 8561847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 8661847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 8761847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 8861847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 8961847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 9061847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 9161847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 9261847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 9361847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 9461847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 9561847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 9661847f8eSopenharmony_ci * @since 10 9761847f8eSopenharmony_ci */ 9861847f8eSopenharmony_ci function getFreeSizeSync(path: string): number; 9961847f8eSopenharmony_ci 10061847f8eSopenharmony_ci /** 10161847f8eSopenharmony_ci * Get the number of total bytes on the specified path. 10261847f8eSopenharmony_ci * 10361847f8eSopenharmony_ci * @param { string } path - path 10461847f8eSopenharmony_ci * @returns { Promise<number> } return Promise 10561847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 10661847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 10761847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 10861847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 10961847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 11061847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 11161847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 11261847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 11361847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 11461847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 11561847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 11661847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 11761847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 11861847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 11961847f8eSopenharmony_ci * @since 9 12061847f8eSopenharmony_ci */ 12161847f8eSopenharmony_ci function getTotalSize(path: string): Promise<number>; 12261847f8eSopenharmony_ci 12361847f8eSopenharmony_ci /** 12461847f8eSopenharmony_ci * Get the number of total bytes on the specified path. 12561847f8eSopenharmony_ci * 12661847f8eSopenharmony_ci * @param { string } path - path 12761847f8eSopenharmony_ci * @param { AsyncCallback<number> } [callback] - callback 12861847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 12961847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 13061847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 13161847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 13261847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 13361847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 13461847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 13561847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 13661847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 13761847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 13861847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 13961847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 14061847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 14161847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 14261847f8eSopenharmony_ci * @since 9 14361847f8eSopenharmony_ci */ 14461847f8eSopenharmony_ci function getTotalSize(path: string, callback: AsyncCallback<number>): void; 14561847f8eSopenharmony_ci 14661847f8eSopenharmony_ci /** 14761847f8eSopenharmony_ci * Get the number of total bytes on the specified path with sync interface. 14861847f8eSopenharmony_ci * 14961847f8eSopenharmony_ci * @param { string } path - path 15061847f8eSopenharmony_ci * @returns { number } return the number of total bytes 15161847f8eSopenharmony_ci * @throws { BusinessError } 13900002 - No such file or directory 15261847f8eSopenharmony_ci * @throws { BusinessError } 13900004 - Interrupted system call 15361847f8eSopenharmony_ci * @throws { BusinessError } 13900005 - I/O error 15461847f8eSopenharmony_ci * @throws { BusinessError } 13900008 - Bad file descriptor 15561847f8eSopenharmony_ci * @throws { BusinessError } 13900011 - Out of memory 15661847f8eSopenharmony_ci * @throws { BusinessError } 13900012 - Permission denied 15761847f8eSopenharmony_ci * @throws { BusinessError } 13900013 - Bad address 15861847f8eSopenharmony_ci * @throws { BusinessError } 13900018 - Not a directory 15961847f8eSopenharmony_ci * @throws { BusinessError } 13900030 - File name too long 16061847f8eSopenharmony_ci * @throws { BusinessError } 13900031 - Function not implemented 16161847f8eSopenharmony_ci * @throws { BusinessError } 13900033 - Too many symbolic links encountered 16261847f8eSopenharmony_ci * @throws { BusinessError } 13900038 - Value too large for defined data type 16361847f8eSopenharmony_ci * @throws { BusinessError } 13900042 - Unknown error 16461847f8eSopenharmony_ci * @syscap SystemCapability.FileManagement.File.FileIO 16561847f8eSopenharmony_ci * @since 10 16661847f8eSopenharmony_ci */ 16761847f8eSopenharmony_ci function getTotalSizeSync(path: string): number; 16861847f8eSopenharmony_ci} 16961847f8eSopenharmony_ci 17061847f8eSopenharmony_ciexport default statfs; 171