mirror of
https://github.com/gchq/CyberChef
synced 2026-01-08 03:23:34 +00:00
Add tests, however non-functional due to lack of File in Node
Also add jimp to package.json
This commit is contained in:
@@ -855,7 +855,7 @@ class Utils {
|
||||
let dataURI = "data:";
|
||||
dataURI += type + ";";
|
||||
dataURI += "base64," + toBase64(buff);
|
||||
return "<img src='" + dataURI + "'>";
|
||||
return "<img style='max-width: 100%;' src='" + dataURI + "'>";
|
||||
} else {
|
||||
return `<pre>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</pre>`;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class SplitColourChannels extends Operation {
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "red.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError("Could not split red channel."));
|
||||
reject(new OperationError(`Could not split red channel: ${err}`));
|
||||
}
|
||||
});
|
||||
const green = new Promise(async (resolve, reject) => {
|
||||
@@ -76,7 +76,7 @@ class SplitColourChannels extends Operation {
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "green.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError("Could not split green channel."));
|
||||
reject(new OperationError(`Could not split green channel: ${err}`));
|
||||
}
|
||||
});
|
||||
const blue = new Promise(async (resolve, reject) => {
|
||||
@@ -88,7 +88,7 @@ class SplitColourChannels extends Operation {
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
resolve(new File([new Uint8Array((await split).values())], "blue.png", {type: "image/png"}));
|
||||
} catch (err) {
|
||||
reject(new OperationError("Could not split blue channel."));
|
||||
reject(new OperationError(`Could not split blue channel: ${err}`));
|
||||
}
|
||||
});
|
||||
return await Promise.all([red, green, blue]);
|
||||
|
||||
Reference in New Issue
Block a user