• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 2021-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 Environment APIs.
20 *
21 * @since 8
22 * @syscap SystemCapability.FileManagement.File.Environment
23 * @systemapi
24 */
25declare namespace Environment {
26  /**
27   * Get the user data path.
28   *
29   * @since 8
30   * @syscap SystemCapability.FileManagement.File.Environment
31   * @systemapi
32   * @param {AsyncCallback<string>} [callback] - callback
33   * @returns {void | Promise<string>} no callback return Promise otherwise return void
34   * @throws { BusinessError } 202  - The caller is not a system application
35   * @throws { BusinessError } 13900020  - Invalid argument
36   * @throws { BusinessError } 13900042  - Unknown error
37   */
38  function getStorageDataDir(): Promise<string>;
39  function getStorageDataDir(callback: AsyncCallback<string>): void;
40
41  /**
42   * Get the User storage path.
43   *
44   * @since 8
45   * @syscap SystemCapability.FileManagement.File.Environment
46   * @systemapi
47   * @param {AsyncCallback<string>} [callback] - callback
48   * @returns {void | Promise<string>} no callback return Promise otherwise return void
49   * @throws { BusinessError } 202  - The caller is not a system application
50   * @throws { BusinessError } 13900020  - Invalid argument
51   * @throws { BusinessError } 13900042  - Unknown error
52   */
53  function getUserDataDir(): Promise<string>;
54  function getUserDataDir(callback: AsyncCallback<string>): void;
55}
56
57export default Environment;
58