fix: remove redundant local variables (#5654)

This commit is contained in:
自由的世界人
2025-05-04 19:56:56 +08:00
committed by GitHub
parent 5ceb2af056
commit f258f5b2cb
12 changed files with 17 additions and 31 deletions
+2 -3
View File
@@ -9,14 +9,13 @@ const gunzipPromise = util.promisify(zlib.gunzip)
/**
* 压缩字符串
* @param {string} string - 要压缩的 JSON 字符串
* @returns {Promise<Buffer>} 压缩后的 Buffer
* @param str
*/
export async function compress(str) {
try {
const buffer = Buffer.from(str, 'utf-8')
const compressedBuffer = await gzipPromise(buffer)
return compressedBuffer
return await gzipPromise(buffer)
} catch (error) {
logger.error('Compression failed:', error)
throw error