Compression level now dropdown.
This commit is contained in:
parent
4ba952e6e2
commit
5aeb8e61c2
@ -22,17 +22,20 @@ class ZstdCompress extends Operation {
|
|||||||
|
|
||||||
this.name = "Zstd Compress";
|
this.name = "Zstd Compress";
|
||||||
this.module = "Compression";
|
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.infoURL = "https://wikipedia.org/wiki/Zstandard";
|
||||||
this.inputType = "ArrayBuffer";
|
this.inputType = "ArrayBuffer";
|
||||||
this.outputType = "ArrayBuffer";
|
this.outputType = "ArrayBuffer";
|
||||||
this.args = [
|
this.args = [
|
||||||
{
|
{
|
||||||
name: "Compression level",
|
name: "Compression level",
|
||||||
type: "number",
|
type: "option",
|
||||||
value: 3,
|
value: [
|
||||||
min: 1,
|
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
|
||||||
max: 22
|
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
|
||||||
|
"21", "22"
|
||||||
|
],
|
||||||
|
defaultIndex: 2
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -43,7 +46,7 @@ class ZstdCompress extends Operation {
|
|||||||
* @returns {ArrayBuffer}
|
* @returns {ArrayBuffer}
|
||||||
*/
|
*/
|
||||||
async run(input, args) {
|
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 (input.byteLength === 0) throw new OperationError("Please provide an input.");
|
||||||
if (isWorkerEnvironment()) self.sendStatusMessage("Loading Zstd...");
|
if (isWorkerEnvironment()) self.sendStatusMessage("Loading Zstd...");
|
||||||
await zstdInit();
|
await zstdInit();
|
||||||
|
|||||||
@ -15,7 +15,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Zstd Compress",
|
op: "Zstd Compress",
|
||||||
args: [3]
|
args: ["3"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: "Zstd Decompress",
|
op: "Zstd Decompress",
|
||||||
@ -31,7 +31,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Zstd Compress",
|
op: "Zstd Compress",
|
||||||
args: [3]
|
args: ["3"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
op: "To Hex",
|
op: "To Hex",
|
||||||
@ -62,7 +62,7 @@ TestRegister.addTests([
|
|||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "Zstd Compress",
|
op: "Zstd Compress",
|
||||||
args: [3]
|
args: ["3"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user