2022-12-20 08:46:35 +00:00
|
|
|
/*
|
2023-04-03 03:17:58 +00:00
|
|
|
* Copyright (c) 2022-2023 Huawei Device Co., Ltd.
|
2022-12-20 08:46:35 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2023-05-30 05:53:09 +00:00
|
|
|
|
|
|
|
import type { AsyncCallback } from './@ohos.base';
|
2022-12-20 08:46:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hash
|
2023-04-03 03:17:58 +00:00
|
|
|
*
|
|
|
|
* @namespace hash
|
2022-12-20 08:46:35 +00:00
|
|
|
* @syscap SystemCapability.FileManagement.File.FileIO
|
|
|
|
* @since 9
|
|
|
|
*/
|
2023-02-15 08:23:01 +00:00
|
|
|
declare namespace hash {
|
2023-04-03 03:17:58 +00:00
|
|
|
/**
|
|
|
|
* Hash file.
|
|
|
|
*
|
|
|
|
* @param { string } path - path.
|
|
|
|
* @param { string } algorithm - algorithm md5 sha1 sha256.
|
|
|
|
* @returns { Promise<string> } return Promise
|
|
|
|
* @throws { BusinessError } 13900020 - Invalid argument
|
|
|
|
* @throws { BusinessError } 13900042 - Unknown error
|
|
|
|
* @syscap SystemCapability.FileManagement.File.FileIO
|
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function hash(path: string, algorithm: string): Promise<string>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hash file.
|
|
|
|
*
|
|
|
|
* @param { string } path - path.
|
|
|
|
* @param { string } algorithm - algorithm md5 sha1 sha256.
|
|
|
|
* @param { AsyncCallback<string> } [callback] - callback.
|
|
|
|
* @throws { BusinessError } 13900020 - Invalid argument
|
|
|
|
* @throws { BusinessError } 13900042 - Unknown error
|
|
|
|
* @syscap SystemCapability.FileManagement.File.FileIO
|
|
|
|
* @since 9
|
|
|
|
*/
|
|
|
|
function hash(path: string, algorithm: string, callback: AsyncCallback<string>): void;
|
2022-12-20 08:46:35 +00:00
|
|
|
}
|
|
|
|
|
2023-02-15 08:23:01 +00:00
|
|
|
export default hash;
|