From 08e0cac598e86b6e9a08a824fef52337da3c737d Mon Sep 17 00:00:00 2001 From: longwei Date: Sun, 9 Oct 2022 19:53:23 +0800 Subject: [PATCH] add compress and decompress for zlib Signed-off-by: longwei Change-Id: I3f4f3b8d6492cdaf75fc40398a38e54ea89bfbe7 --- api/@ohos.zlib.d.ts | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/api/@ohos.zlib.d.ts b/api/@ohos.zlib.d.ts index a7da314d6e..6aca560c79 100644 --- a/api/@ohos.zlib.d.ts +++ b/api/@ohos.zlib.d.ts @@ -22,6 +22,7 @@ declare namespace zlib { * @syscap SystemCapability.BundleManager.Zlib * @import NA * @permission NA + * @deprecated since 9 */ export enum ErrorCode { ERROR_CODE_OK = 0, @@ -91,6 +92,8 @@ declare namespace zlib { * @param inFile Indicates the path of the file to be compressed. * @param outFile Indicates the path of the output compressed file. * @return Returns error code. + * @deprecated since 9 + * @useinstead ohos.zlib#compressFile */ function zipFile(inFile:string, outFile:string, options: Options): Promise; @@ -102,7 +105,66 @@ declare namespace zlib { * @param inFile Indicates the path of the file to be decompressed. * @param outFile Indicates the path of the decompressed file. * @return Returns error code. + * @deprecated since 9 + * @useinstead ohos.zlib#decompressFile */ function unzipFile(inFile:string, outFile:string, options: Options): Promise; + + /** + * Compress the specified file. + * @param {string} inFile Indicates the path of the file to be compressed. + * @param {string} outFile Indicates the path of the output compressed file. + * @param {Options} options Indicates the options of compressing file. + * @param {AsyncCallback} callback - The callback of compressing file result. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 900001 - The input source file is invalid. + * @throws {BusinessError} 900002 - The input destination file is invalid. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function compressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback): void; + + /** + * Compress the specified file. + * @param {string} inFile Indicates the path of the file to be compressed. + * @param {string} outFile Indicates the path of the output compressed file. + * @param {Options} options Indicates the options of compressing file. + * @returns {Promise} Returns the result of compressFile file. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 900001 - The input source file is invalid. + * @throws {BusinessError} 900002 - The input destination file is invalid. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function compressFile(inFile:string, outFile:string, options: Options): Promise; + + /** + * Decompress the specified file. + * @param {string} inFile Indicates the path of the file to be decompressed. + * @param {string} outFile Indicates the path of the output decompressed file. + * @param {Options} options Indicates the options of decompressing file. + * @param {AsyncCallback} callback - The callback of decompressing file result. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 900001 - The input source file is invalid. + * @throws {BusinessError} 900002 - The input destination file is invalid. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function decompressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback): void; + + /** + * Decompress the specified file. + * @param {string} inFile Indicates the path of the file to be decompressed. + * @param {string} outFile Indicates the path of the output decompressing file. + * @param {Options} options Indicates the options of decompressing file. + * @returns {Promise} Returns the result of decompressing file. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 900001 - The input source file is invalid. + * @throws {BusinessError} 900002 - The input destination file is invalid. + * @syscap SystemCapability.BundleManager.Zlib + * @since 9 + */ + function decompressFile(inFile: string, outFile: string, options: Options): Promise; + } export default zlib; \ No newline at end of file -- Gitee