• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-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
16/**
17 * @file
18 * @kit CoreFileKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22
23/**
24 * Hash
25 *
26 * @namespace hash
27 * @syscap SystemCapability.FileManagement.File.FileIO
28 * @since 9
29 */
30/**
31 * Hash
32 *
33 * @namespace hash
34 * @syscap SystemCapability.FileManagement.File.FileIO
35 * @atomicservice
36 * @since 11
37 */
38declare namespace hash {
39  /**
40   * Hash file.
41   *
42   * @param { string } path - path.
43   * @param { string } algorithm - algorithm md5 sha1 sha256.
44   * @returns { Promise<string> } return Promise
45   * @throws { BusinessError } 13900020 - Invalid argument
46   * @throws { BusinessError } 13900042 - Unknown error
47   * @syscap SystemCapability.FileManagement.File.FileIO
48   * @since 9
49   */
50  /**
51   * Hash file.
52   *
53   * @param { string } path - path.
54   * @param { string } algorithm - algorithm md5 sha1 sha256.
55   * @returns { Promise<string> } return Promise
56   * @throws { BusinessError } 13900020 - Invalid argument
57   * @throws { BusinessError } 13900042 - Unknown error
58   * @syscap SystemCapability.FileManagement.File.FileIO
59   * @atomicservice
60   * @since 11
61   */
62  function hash(path: string, algorithm: string): Promise<string>;
63
64  /**
65   * Hash file.
66   *
67   * @param { string } path - path.
68   * @param { string } algorithm - algorithm md5 sha1 sha256.
69   * @param { AsyncCallback<string> } [callback] - callback.
70   * @throws { BusinessError } 13900020 - Invalid argument
71   * @throws { BusinessError } 13900042 - Unknown error
72   * @syscap SystemCapability.FileManagement.File.FileIO
73   * @since 9
74   */
75  /**
76   * Hash file.
77   *
78   * @param { string } path - path.
79   * @param { string } algorithm - algorithm md5 sha1 sha256.
80   * @param { AsyncCallback<string> } [callback] - callback.
81   * @throws { BusinessError } 13900020 - Invalid argument
82   * @throws { BusinessError } 13900042 - Unknown error
83   * @syscap SystemCapability.FileManagement.File.FileIO
84   * @atomicservice
85   * @since 11
86   */
87  function hash(path: string, algorithm: string, callback: AsyncCallback<string>): void;
88}
89
90export default hash;
91