mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
add Buffer translation to Dish. Cannot work in SyncDish as typeEnums are static. Seeing as they will never be hit in the broswer, shouldnt be an issue
This commit is contained in:
parent
fbcb626fd0
commit
223e2e0b73
4 changed files with 48 additions and 8 deletions
|
@ -92,6 +92,9 @@ class SyncDish extends Dish {
|
|||
case Dish.JSON:
|
||||
this.value = this.value ? Utils.strToByteArray(JSON.stringify(this.value)) : [];
|
||||
break;
|
||||
case Dish.BUFFER:
|
||||
this.value = this.value instanceof Buffer ? this.value.buffer : [];
|
||||
break;
|
||||
// case Dish.FILE:
|
||||
// this.value = Utils.readFileSync(this.value);
|
||||
// this.value = Array.prototype.slice.call(this.value);
|
||||
|
@ -134,6 +137,10 @@ class SyncDish extends Dish {
|
|||
this.value = JSON.parse(byteArrayToStr(this.value));
|
||||
this.type = Dish.JSON;
|
||||
break;
|
||||
case Dish.BUFFER:
|
||||
this.value = Buffer.from(new Uint8Array(this.value));
|
||||
this.type = Dish.BUFFER;
|
||||
break;
|
||||
// case Dish.FILE:
|
||||
// this.value = new File(this.value, "unknown");
|
||||
// break;
|
||||
|
@ -145,7 +152,7 @@ class SyncDish extends Dish {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export default SyncDish;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue