MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / tryUnzip

Function tryUnzip

daemon/src/common/compress.ts:73–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

71 throw new Error(COMPRESS_ERROR_MSG.invalidName);
72
73 const tryUnzip = async () => {
74 if (!isZipFormat(zipPath)) {
75 const fileExt = getFileExtension(zipPath);
76 throw new Error($t("TXT_CODE_69c42450", { fileExt: fileExt }));
77 }
78
79 if (isMultiVolume(zipPath)) {
80 throw new Error($t("TXT_CODE_91d066aa"));
81 }
82 try {
83 return await useUnzip(zipPath, dest, fileCode || "utf-8");
84 } catch (error: any) {
85 logger.error($t("TXT_CODE_842929d0", { message: error.message }));
86 throw new Error(
87 $t("TXT_CODE_f0512848", {
88 message: error?.message
89 })
90 );
91 }
92 };
93
94 if (await check7zipStatus()) {
95 try {

Callers 1

decompressFunction · 0.85

Calls 6

isZipFormatFunction · 0.90
getFileExtensionFunction · 0.90
$tFunction · 0.90
isMultiVolumeFunction · 0.90
useUnzipFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected