mirror of
https://github.com/gchq/CyberChef
synced 2025-12-05 23:53:27 +00:00
incorporate ArrayBuffer base Dish type. Add global file shim to node index. Fix Buffer -> ArrayBuffer transformation
This commit is contained in:
@@ -94,7 +94,7 @@ class Utils {
|
||||
const paddedBytes = new Array(numBytes);
|
||||
paddedBytes.fill(padByte);
|
||||
|
||||
Array.prototype.map.call(arr, function(b, i) {
|
||||
[...arr].forEach((b, i) => {
|
||||
paddedBytes[i] = b;
|
||||
});
|
||||
|
||||
@@ -1033,8 +1033,10 @@ class Utils {
|
||||
if (!Utils.isNode()) {
|
||||
throw new TypeError("Browser environment cannot support readFileSync");
|
||||
}
|
||||
|
||||
return file.data.buffer;
|
||||
// Resist using node's Buffer.buffer here - this yields a 8192 length byteArray
|
||||
// regardless of the length of the buffer.
|
||||
const arrayBuffer = Uint8Array.from(file.data);
|
||||
return arrayBuffer.buffer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user