diff --git a/src/core/operations/ZstdCompress.mjs b/src/core/operations/ZstdCompress.mjs index 909f0eb7..4f03ebf4 100644 --- a/src/core/operations/ZstdCompress.mjs +++ b/src/core/operations/ZstdCompress.mjs @@ -22,17 +22,20 @@ class ZstdCompress extends Operation { this.name = "Zstd Compress"; this.module = "Compression"; - this.description = "Compresses data using the Zstandard (Zstd) algorithm. Zstd offers high compression ratios at fast speeds and is widely used in Linux, databases, container images, and network protocols."; + this.description = "Compresses data using the Zstandard (Zstd) algorithm. Zstd offers high compression ratios at fast speeds and is widely used in Linux, databases, container images, and network protocols. Higher compression levels result in better compression but slower speed."; this.infoURL = "https://wikipedia.org/wiki/Zstandard"; this.inputType = "ArrayBuffer"; this.outputType = "ArrayBuffer"; this.args = [ { name: "Compression level", - type: "number", - value: 3, - min: 1, - max: 22 + type: "option", + value: [ + "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", + "21", "22" + ], + defaultIndex: 2 } ]; } @@ -43,7 +46,7 @@ class ZstdCompress extends Operation { * @returns {ArrayBuffer} */ async run(input, args) { - const [level] = args; + const level = parseInt(args[0], 10); if (input.byteLength === 0) throw new OperationError("Please provide an input."); if (isWorkerEnvironment()) self.sendStatusMessage("Loading Zstd..."); await zstdInit(); diff --git a/tests/operations/tests/Zstd.mjs b/tests/operations/tests/Zstd.mjs index da9577d5..33b3c3c4 100644 --- a/tests/operations/tests/Zstd.mjs +++ b/tests/operations/tests/Zstd.mjs @@ -15,7 +15,7 @@ TestRegister.addTests([ recipeConfig: [ { op: "Zstd Compress", - args: [3] + args: ["3"] }, { op: "Zstd Decompress", @@ -31,7 +31,7 @@ TestRegister.addTests([ recipeConfig: [ { op: "Zstd Compress", - args: [3] + args: ["3"] }, { op: "To Hex", @@ -62,7 +62,7 @@ TestRegister.addTests([ recipeConfig: [ { op: "Zstd Compress", - args: [3] + args: ["3"] } ] },