From 953a581a946baa2add0616eae06e848683016352 Mon Sep 17 00:00:00 2001 From: n1073645 Date: Mon, 17 Aug 2020 14:12:29 +0100 Subject: [PATCH 1/2] byte length arg added --- src/core/operations/FromBinary.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/operations/FromBinary.mjs b/src/core/operations/FromBinary.mjs index 15e5d663..0bb7a45c 100644 --- a/src/core/operations/FromBinary.mjs +++ b/src/core/operations/FromBinary.mjs @@ -31,6 +31,11 @@ class FromBinary extends Operation { "name": "Delimiter", "type": "option", "value": BIN_DELIM_OPTIONS + }, + { + "name": "Byte Length", + "type": "number", + "value": 8 } ]; this.checks = [ @@ -78,7 +83,8 @@ class FromBinary extends Operation { * @returns {byteArray} */ run(input, args) { - return fromBinary(input, args[0]); + const byteLen = args[1] ? args[1] : 8; + return fromBinary(input, args[0], byteLen); } /** From 9dba1232b76249f7140cfd7f9e3e7b72eb779143 Mon Sep 17 00:00:00 2001 From: n1073645 Date: Mon, 24 Aug 2020 09:41:05 +0100 Subject: [PATCH 2/2] byte length argument added to ToBinary --- src/core/operations/ToBinary.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/operations/ToBinary.mjs b/src/core/operations/ToBinary.mjs index 95d004b0..ba72a55b 100644 --- a/src/core/operations/ToBinary.mjs +++ b/src/core/operations/ToBinary.mjs @@ -31,6 +31,11 @@ class ToBinary extends Operation { "name": "Delimiter", "type": "option", "value": BIN_DELIM_OPTIONS + }, + { + "name": "Byte Length", + "type": "number", + "value": 8 } ]; } @@ -42,7 +47,8 @@ class ToBinary extends Operation { */ run(input, args) { input = new Uint8Array(input); - return toBinary(input, args[0]); + const padding = args[1] ? args[1] : 8; + return toBinary(input, args[0], padding); } /**