1/* 2 * Copyright (C) 2021-2023 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 type { AsyncCallback } from './@ohos.base'; 17 18/** 19 * Provides Environment APIs. 20 * 21 * @namespace Environment 22 * @syscap SystemCapability.FileManagement.File.Environment 23 * @systemapi 24 * @since 8 25 */ 26declare namespace Environment { 27 /** 28 * Get the user data path. 29 * 30 * @returns { Promise<string> } return Promise 31 * @throws { BusinessError } 202 - The caller is not a system application 32 * @throws { BusinessError } 13900020 - Invalid argument 33 * @throws { BusinessError } 13900042 - Unknown error 34 * @syscap SystemCapability.FileManagement.File.Environment 35 * @systemapi 36 * @since 8 37 */ 38 function getStorageDataDir(): Promise<string>; 39 40 /** 41 * Get the user data path. 42 * 43 * @param { AsyncCallback<string> } [callback] - callback 44 * @throws { BusinessError } 202 - The caller is not a system application 45 * @throws { BusinessError } 13900020 - Invalid argument 46 * @throws { BusinessError } 13900042 - Unknown error 47 * @syscap SystemCapability.FileManagement.File.Environment 48 * @systemapi 49 * @since 8 50 */ 51 function getStorageDataDir(callback: AsyncCallback<string>): void; 52 53 /** 54 * Get the User storage path. 55 * 56 * @returns { Promise<string> } return Promise 57 * @throws { BusinessError } 202 - The caller is not a system application 58 * @throws { BusinessError } 13900020 - Invalid argument 59 * @throws { BusinessError } 13900042 - Unknown error 60 * @syscap SystemCapability.FileManagement.File.Environment 61 * @systemapi 62 * @since 8 63 */ 64 function getUserDataDir(): Promise<string>; 65 66 /** 67 * Get the User storage path. 68 * 69 * @param { AsyncCallback<string> } [callback] - callback 70 * @throws { BusinessError } 202 - The caller is not a system application 71 * @throws { BusinessError } 13900020 - Invalid argument 72 * @throws { BusinessError } 13900042 - Unknown error 73 * @syscap SystemCapability.FileManagement.File.Environment 74 * @systemapi 75 * @since 8 76 */ 77 function getUserDataDir(callback: AsyncCallback<string>): void; 78} 79 80export default Environment; 81