Fetch the repository succeeded.
/*
* Copyright (c) 2022-2025 Huawei Device Co., Ltd.
* 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.
*/
/**
* @file
* @kit CoreFileKit
*/
import type { AsyncCallback } from './@ohos.base';
/*** if arkts 1.1 */
import stream from './@ohos.util.stream';
/*** endif */
/**
* Hash
*
* @namespace hash
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 9
*/
/**
* Hash
*
* @namespace hash
* @syscap SystemCapability.FileManagement.File.FileIO
* @atomicservice
* @since 11
*/
/**
* Hash
*
* @namespace hash
* @syscap SystemCapability.FileManagement.File.FileIO
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.1&1.2
*/
declare namespace hash {
/**
* 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
*/
/**
* 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
* @atomicservice
* @since 11
*/
/**
* 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
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.1&1.2
*/
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
*/
/**
* 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
* @atomicservice
* @since 11
*/
/**
* 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
* @crossplatform
* @atomicservice
* @since 20
* @arkts 1.1&1.2
*/
function hash(path: string, algorithm: string, callback: AsyncCallback<string>): void;
/**
* Hash Stream.
*
* @extends stream.Transform
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 12
*/
/**
* Hash Stream.
*
* @extends stream.Transform
* @syscap SystemCapability.FileManagement.File.FileIO
* @crossplatform
* @since 20
*/
class HashStream extends stream.Transform {
/**
* Calculate the digest of all of the data passed to be hashed.
*
* @returns { string } Returns the hexadecimal data string of the hash result.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 12
*/
/**
* Calculate the digest of all of the data passed to be hashed.
*
* @returns { string } Returns the hexadecimal data string of the hash result.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @crossplatform
* @since 20
*/
digest(): string;
/**
* Update the hash content with the given data.
*
* @param { ArrayBuffer } data - updated data.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 12
*/
/**
* Update the hash content with the given data.
*
* @param { ArrayBuffer } data - updated data.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @crossplatform
* @since 20
*/
update(data: ArrayBuffer): void;
}
/**
* Create file read stream.
*
* @param { string } algorithm - hash algorithm.
* @returns { HashStream } Returns the ReadStream object which has been created.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @since 12
*/
/**
* Create file read stream.
*
* @param { string } algorithm - hash algorithm.
* @returns { HashStream } Returns the ReadStream object which has been created.
* @throws { BusinessError } 401 - Parameter error
* @throws { BusinessError } 13900020 - Invalid argument
* @throws { BusinessError } 13900042 - Unknown error
* @syscap SystemCapability.FileManagement.File.FileIO
* @crossplatform
* @since 20
*/
function createHash(algorithm: string): HashStream;
}
export default hash;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。