1/* 2* Copyright (C) 2022 Huawei Device Co., Ltd. 3* Licensed under the Apache License, Version 2.0 (the "License"); 4* you may not use this file except in compliance with the License. 5* You may obtain a copy of the License at 6* 7* http://www.apache.org/licenses/LICENSE-2.0 8* 9* Unless required by applicable law or agreed to in writing, software 10* distributed under the License is distributed on an "AS IS" BASIS, 11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12* See the License for the specific language governing permissions and 13* limitations under the License. 14*/ 15 16import { AsyncCallback } from "./basic"; 17 18/** 19 * Provides filesystem statistics APIs 20 * 21 * @since 9 22 * @syscap SystemCapability.FileManagement.File.FileIO 23 */ 24declare namespace statfs { 25 /** 26 * Get the number of free bytes on the specified path. 27 * 28 * @syscap SystemCapability.FileManagement.File.FileIO 29 * @since 9 30 * @param {string} path - path 31 * @param {AsyncCallback<number>} [callback] - callback 32 * @returns {void | Promise<number>} no callback return Promise otherwise return void 33 * @throws { BusinessError } 13900002 - No such file or directory 34 * @throws { BusinessError } 13900004 - Interrupted system call 35 * @throws { BusinessError } 13900005 - I/O error 36 * @throws { BusinessError } 13900008 - Bad file descriptor 37 * @throws { BusinessError } 13900011 - Out of memory 38 * @throws { BusinessError } 13900012 - Permission denied 39 * @throws { BusinessError } 13900013 - Bad address 40 * @throws { BusinessError } 13900018 - Not a directory 41 * @throws { BusinessError } 13900030 - File name too long 42 * @throws { BusinessError } 13900031 - Function not implemented 43 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 44 * @throws { BusinessError } 13900038 - Value too large for defined data type 45 * @throws { BusinessError } 13900042 - Unknown error 46 */ 47 function getFreeSize(path: string): Promise<number>; 48 function getFreeSize(path: string, callback: AsyncCallback<number>): void; 49 50 /** 51 * Get the number of total bytes on the specified path. 52 * 53 * @syscap SystemCapability.FileManagement.File.FileIO 54 * @since 9 55 * @param {string} path - path 56 * @param {AsyncCallback<number>} [callback] - callback 57 * @returns {void | Promise<number>} no callback return Promise otherwise return void 58 * @throws { BusinessError } 13900002 - No such file or directory 59 * @throws { BusinessError } 13900004 - Interrupted system call 60 * @throws { BusinessError } 13900005 - I/O error 61 * @throws { BusinessError } 13900008 - Bad file descriptor 62 * @throws { BusinessError } 13900011 - Out of memory 63 * @throws { BusinessError } 13900012 - Permission denied 64 * @throws { BusinessError } 13900013 - Bad address 65 * @throws { BusinessError } 13900018 - Not a directory 66 * @throws { BusinessError } 13900030 - File name too long 67 * @throws { BusinessError } 13900031 - Function not implemented 68 * @throws { BusinessError } 13900033 - Too many symbolic links encountered 69 * @throws { BusinessError } 13900038 - Value too large for defined data type 70 * @throws { BusinessError } 13900042 - Unknown error 71 */ 72 function getTotalSize(path: string): Promise<number>; 73 function getTotalSize(path: string, callback: AsyncCallback<number>): void; 74} 75 76export default statfs; 77