mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 06:55:08 -04:00
Remove Buffer from Dish. Convert into ByteArray in api and then pass in as ArrayBuffer. Add some PNG files to tests
This commit is contained in:
parent
20bb104006
commit
55f7cac526
3 changed files with 14 additions and 45 deletions
|
@ -108,15 +108,20 @@ function ensureIsDish(input) {
|
|||
dish.set(input, type);
|
||||
}
|
||||
return dish;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* prepareOp: transform args, make input the right type.
|
||||
* Also convert any Buffers to ArrayBuffers.
|
||||
* @param opInstance - instance of the operation
|
||||
* @param input - operation input
|
||||
* @param args - operation args
|
||||
*/
|
||||
function prepareOp(opInstance, input, args) {
|
||||
// convert any Buffers into ArrayBuffers.
|
||||
if (input instanceof Buffer) {
|
||||
input = input.buffer;
|
||||
}
|
||||
const dish = ensureIsDish(input);
|
||||
let transformedArgs;
|
||||
// Transform object-style args to original args array
|
||||
|
@ -127,7 +132,7 @@ function prepareOp(opInstance, input, args) {
|
|||
}
|
||||
const transformedInput = dish.get(opInstance.inputType);
|
||||
return {transformedInput, transformedArgs};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap an operation to be consumed by node API.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue