mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 07:46:16 -04:00
Updated eslint, Jimp, and other dependencies
This commit is contained in:
parent
7eb887ca51
commit
2b275f0897
35 changed files with 2939 additions and 1926 deletions
|
@ -8,7 +8,7 @@ import Operation from "../Operation.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
import Utils from "../Utils.mjs";
|
||||
import {isImage} from "../lib/FileType.mjs";
|
||||
import jimp from "jimp";
|
||||
import Jimp from "jimp/es/index.js";
|
||||
|
||||
/**
|
||||
* Split Colour Channels operation
|
||||
|
@ -41,7 +41,7 @@ class SplitColourChannels extends Operation {
|
|||
// Make sure that the input is an image
|
||||
if (!isImage(input)) throw new OperationError("Invalid file type.");
|
||||
|
||||
const parsedImage = await jimp.read(Buffer.from(input));
|
||||
const parsedImage = await Jimp.read(Buffer.from(input));
|
||||
|
||||
const red = new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
|
@ -51,7 +51,7 @@ class SplitColourChannels extends Operation {
|
|||
{apply: "blue", params: [-255]},
|
||||
{apply: "green", params: [-255]}
|
||||
])
|
||||
.getBufferAsync(jimp.MIME_PNG);
|
||||
.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: ${err}`));
|
||||
|
@ -64,7 +64,7 @@ class SplitColourChannels extends Operation {
|
|||
.color([
|
||||
{apply: "red", params: [-255]},
|
||||
{apply: "blue", params: [-255]},
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
]).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: ${err}`));
|
||||
|
@ -77,7 +77,7 @@ class SplitColourChannels extends Operation {
|
|||
.color([
|
||||
{apply: "red", params: [-255]},
|
||||
{apply: "green", params: [-255]},
|
||||
]).getBufferAsync(jimp.MIME_PNG);
|
||||
]).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: ${err}`));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue