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 */ 15import { AsyncCallback } from './basic' 16 17/** 18 * Hash 19 * @syscap SystemCapability.FileManagement.File.FileIO 20 * @since 9 21 */ 22declare namespace hash { 23 /** 24 * Hash file. 25 * @static 26 * @syscap SystemCapability.FileManagement.File.FileIO 27 * @since 9 28 * @param {string} path - path. 29 * @param {string} algorithm - algorithm md5 sha1 sha256. 30 * @param {AsyncCallback<string>} [callback] - callback. 31 * @returns {void | Promise<string>} no callback return Promise otherwise return void 32 * @throws { BusinessError } 13900020 - Invalid argument 33 * @throws { BusinessError } 13900042 - Unknown error 34 */ 35 function hash(path: string, algorithm: string): Promise<string>; 36 function hash(path: string, algorithm: string, callback: AsyncCallback<string>): void; 37} 38 39export default hash; 40