Changed image function syntax, improved dice, switched to fs.promises, might have also done other stuff but idk

This commit is contained in:
TheEssem 2020-08-27 21:34:12 -05:00
parent 95846d32d4
commit f415b3bb09
91 changed files with 1275 additions and 577 deletions

View File

@ -4,7 +4,7 @@
"target_name": "image",
"sources": [ "<!@(node -p \"require('fs').readdirSync('./natives').map(f=>'natives/'+f).join(' ')\")" ],
"cflags!": [ "-fno-exceptions", "<!(pkg-config --cflags Magick++ zxing)" ],
"cflags_cc!": [ "-fno-exceptions", "<!(pkg-config --cflags Magick++ zxing )" ],
"cflags_cc!": [ "-fno-exceptions", "<!(pkg-config --cflags Magick++ zxing)" ],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")",
"/usr/include/ImageMagick-7",
@ -12,7 +12,7 @@
"/usr/lib/glib-2.0/include"
],
"libraries": [
"<!(pkg-config --libs Magick++ zxing)",
"<!(pkg-config --libs Magick++ zxing)ZXing",
],
"defines": ["NAPI_DISABLE_CPP_EXCEPTIONS"]
}

View File

@ -1,11 +1,17 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/9gag.png", 6, false, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/9gag.png",
gravity: 6,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `9gag.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/bandicam.png", 2, true, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/bandicam.png",
gravity: 2,
resize: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `bandicam.${image.type}`

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`;
const buffer = await promisify(magick.blur)(image.path, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "blur",
path: image.path,
sharp: false,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `blur.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`;
const buffer = await promisify(magick.blurple)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "blurple",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `blurple.${image.type}`

View File

@ -1,5 +1,4 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message, args) => {
const image = await require("../utils/imagedetect.js")(message);
@ -7,7 +6,13 @@ exports.run = async (message, args) => {
const newArgs = args.filter(item => !item.includes(image.url) );
if (args.length === 0) return `${message.author.mention}, you need to provide some text to add a caption!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const outputFinal = await promisify(magick.caption)(newArgs.join(" "), image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const outputFinal = await magick({
cmd: "caption",
path: image.path,
caption: newArgs.join(" "),
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
await processMessage.delete();
return {
file: outputFinal,

View File

@ -1,5 +1,4 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"];
exports.run = async (message, args) => {
@ -7,7 +6,13 @@ exports.run = async (message, args) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image/GIF to add a caption!`;
const newArgs = args.filter(item => !item.includes(image.url) );
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const outputFinal = await promisify(magick.captionTwo)(newArgs.length !== 0 ? newArgs.join(" ") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "), image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const outputFinal = await magick({
cmd: "captionTwo",
path: image.path,
caption: newArgs.length !== 0 ? newArgs.join(" ") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "),
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
await processMessage.delete();
return {
file: outputFinal,

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add radial blur!`;
const buffer = await promisify(magick.circle)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "circle",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `circle.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to crop!`;
const buffer = await promisify(magick.crop)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "crop",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `crop.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/deviantart.png", 5, true, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/deviantart.png",
gravity: 5,
resize: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `deviantart.${image.type}`

View File

@ -1,10 +1,8 @@
const misc = require("../utils/misc.js");
exports.run = async (message, args) => {
if (args.length === 0 || !args[0].match(/^\d+$/) || args[0] > 1000000) {
return `🎲 The dice landed on ${misc.random([...Array(6).keys()]) + 1}.`;
if (args.length === 0 || !args[0].match(/^\d+$/)) {
return `🎲 The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
} else {
return `🎲 The dice landed on ${misc.random([...Array(parseInt(args[0])).keys()]) + 1}.`;
return `🎲 The dice landed on ${Math.floor(Math.random() * parseInt(args[0])) + 1}.`;
}
};

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`;
const buffer = await promisify(magick.explode)(image.path, -1, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "explode",
path: image.path,
amount: -1,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `explode.${image.type}`

View File

@ -1,5 +1,4 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
const fs = require("fs");
const emojiRegex = require("emoji-regex");
const emoji = require("node-emoji");
@ -16,11 +15,17 @@ exports.run = async (message, args) => {
if (flag === "checkered_flag") path = "./assets/images/checkeredflag.png";
if (flag === "🏳️‍⚧️") path = "./assets/images/transflag.png";
try {
await promisify(fs.access)(path);
await fs.promises.access(path);
} catch (e) {
return `${message.author.mention}, that isn't a flag!`;
}
const buffer = await promisify(magick.flag)(image.path, path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "flag",
path: image.path,
overlay: path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `flag.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`;
const buffer = await promisify(magick.flip)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "flip",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `flip.${image.type}`

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`;
const buffer = await promisify(magick.flop)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "flip",
path: image.path,
flop: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `flop.${image.type}`

View File

@ -1,12 +1,17 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to freeze!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.freeze)(image.path, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "freeze",
path: image.path,
loop: false,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `freeze.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/funky.png", 3, true, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/funky.png",
gravity: 3,
resize: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `funky.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a GameXplain thumbnail meme!`;
const buffer = await promisify(magick.gamexplain)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "gamexplain",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `gamexplain.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await promisify(magick.globe)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "globe",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
await processMessage.delete();
return {
file: buffer,

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await promisify(magick.mirror)(image.path, false, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "mirror",
path: image.path,
first: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `haah.${image.type}`

View File

@ -1,10 +1,12 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Homebrew Channel edit!`;
message.channel.sendTyping();
const buffer = await promisify(magick.homebrew)(args.join(" ").toLowerCase().replace(/\n/g, " "));
const buffer = await magick({
cmd: "homebrew",
caption: args.join(" ").toLowerCase().replace(/\n/g, " ")
});
return {
file: buffer,
name: "homebrew.png"

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await promisify(magick.mirror)(image.path, true, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "mirror",
path: image.path,
vertical: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `hooh.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/hypercam.png", 1, true, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/hypercam.png",
gravity: 1,
resize: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `hypercam.${image.type}`

View File

@ -1,11 +1,19 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/ifunny.png", 8, true, true, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/ifunny.png",
gravity: 8,
resize: true,
append: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `ifunny.${image.type}`

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`;
const buffer = await promisify(magick.explode)(image.path, 1, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "explode",
path: image.path,
amount: 1,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `implode.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`;
const buffer = await promisify(magick.invert)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "invert",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `invert.${image.type}`

View File

@ -1,11 +1,13 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add more JPEG!`;
const buffer = await promisify(magick.jpeg)(image.path);
const buffer = await magick({
cmd: "jpeg",
path: image.path
});
return {
file: buffer,
name: "jpeg.jpg"

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Super Smash Bros. leak meme!`;
const buffer = await promisify(magick.leak)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "leak",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `leak.${image.type}`

View File

@ -1,12 +1,17 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.freeze)(image.path, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "freeze",
path: image.path,
loop: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `loop.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await promisify(magick.magik)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "magik",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
await processMessage.delete();
return {
file: buffer,

View File

@ -1,5 +1,4 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message, args) => {
message.channel.sendTyping();
@ -8,7 +7,14 @@ exports.run = async (message, args) => {
const newArgs = args.filter(item => !item.includes(image.url) );
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a meme!`;
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
const buffer = await promisify(magick.meme)(image.path, topText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"), bottomText ? bottomText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;") : "", image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "meme",
path: image.path,
top: topText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"),
bottom: bottomText ? bottomText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;") : "",
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `meme.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a MemeCenter watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/memecenter.png", 9, false, false, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/memecenter.png",
gravity: 9,
mc: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `memecenter.${image.type}`

View File

@ -1,5 +1,4 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message, args) => {
const image = await require("../utils/imagedetect.js")(message);
@ -8,7 +7,14 @@ exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a motivational poster!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
const buffer = await promisify(magick.motivate)(image.path, topText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"), bottomText ? bottomText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;") : "", image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "motivate",
path: image.path,
top: topText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"),
bottom: bottomText ? bottomText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;") : "",
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
processMessage.delete();
return {
file: buffer,

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to pixelate!`;
const buffer = await promisify(magick.resize)(image.path, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "resize",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `pixelate.${image.type}`

View File

@ -1,12 +1,14 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
const { clean } = require("../utils/misc.js");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image with a QR code to read!`;
message.channel.sendTyping();
const {qrText, missing} = await promisify(magick.qrread)(image.path);
const {qrText, missing} = await magick({
cmd: "qrread",
path: image.path
});
if (missing) return `${message.author.mention}, I couldn't find a QR code!`;
return `\`\`\`\n${await clean(qrText)}\n\`\`\``;
};

View File

@ -1,12 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to reverse!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.reverse)(image.path, false, image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "reverse",
path: image.path,
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: "reverse.gif"

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Scott the Woz TV meme!`;
const buffer = await promisify(magick.scott)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "scott",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `scott.${image.type}`

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
const buffer = await promisify(magick.blur)(image.path, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "sharpen",
path: image.path,
sharp: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `sharpen.${image.type}`

View File

@ -1,11 +1,18 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/shutterstock.png", 5, true, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "watermark",
path: image.path,
water: "./assets/images/shutterstock.png",
gravity: 5,
resize: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `shutterstock.${image.type}`

View File

@ -1,4 +1,4 @@
const magick = require("../build/Release/image.node");
const magick = require("../utils/image.js");
const { promisify } = require("util");
exports.run = async (message) => {
@ -6,7 +6,13 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to slow down!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.speed)(image.path, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "speed",
path: image.path,
slow: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: "slow.gif"

View File

@ -1,12 +1,14 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
const wrap = require("../utils/wrap.js");
exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Sonic meme!`;
message.channel.sendTyping();
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
const buffer = await promisify(magick.sonic)(wrap(cleanedMessage, {width: 15, indent: ""}));
const buffer = await magick({
cmd: "sonic",
text: wrap(cleanedMessage, {width: 15, indent: ""})
});
return {
file: buffer,
name: "sonic.png"

View File

@ -1,12 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.reverse)(image.path, true, image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "reverse",
path: image.path,
soos: true,
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: "soos.gif"

View File

@ -1,12 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to speed up!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await promisify(magick.speed)(image.path, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "speed",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: "speed.gif"

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await promisify(magick.spin)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "spin",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
await processMessage.delete();
return {
file: buffer,

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
const buffer = await promisify(magick.resize)(image.path, true, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "resize",
path: image.path,
stretch: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `stretch.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`;
const buffer = await promisify(magick.swirl)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "swirl",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `swirl.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
const buffer = await promisify(magick.tile)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "tile",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `tile.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`;
const buffer = await promisify(magick.trump)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "trump",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `trump.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await promisify(magick.mirror)(image.path, false, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "mirror",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `waaw.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
const buffer = await promisify(magick.wall)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "wall",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `wall.${image.type}`

View File

@ -1,11 +1,15 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a "who did this" meme!`;
const buffer = await promisify(magick.wdt)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "wdt",
path: image.path,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `wdt.${image.type}`

View File

@ -1,11 +1,16 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`;
const buffer = await promisify(magick.resize)(image.path, false, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "resize",
path: image.path,
wide: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `wide.${image.type}`

View File

@ -1,11 +1,17 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
const magick = require("../utils/image.js");
exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await promisify(magick.mirror)(image.path, true, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await magick({
cmd: "mirror",
path: image.path,
vertical: true,
first: true,
type: image.type.toUpperCase(),
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0
});
return {
file: buffer,
name: `woow.${image.type}`

View File

@ -12,24 +12,19 @@ class BlurWorker : public Napi::AsyncWorker {
~BlurWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> blurred;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
if (sharp) {
image.sharpen(10, 3);
} else {
image.blur(15);
}
image.magick(type);
blurred.push_back(image);
if (sharp) {
for_each(coalesced.begin(), coalesced.end(), sharpenImage(10, 3));
} else {
for_each(coalesced.begin(), coalesced.end(), blurImage(15));
}
optimizeImageLayers(&result, blurred.begin(), blurred.end());
optimizeImageLayers(&result, coalesced.begin(), coalesced.end());
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
writeImages(result.begin(), result.end(), &blob);
}
@ -49,13 +44,14 @@ Napi::Value Blur(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool sharp = info[1].As<Napi::Boolean>().Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool sharp = obj.Get("sharp").As<Napi::Boolean>().Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
BlurWorker* blurWorker = new BlurWorker(cb, in_path, sharp, type, delay);
BlurWorker* blurWorker = new BlurWorker(cb, path, sharp, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class BlurpleWorker : public Napi::AsyncWorker {
~BlurpleWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> blurpled;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> blurpled;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -45,12 +45,13 @@ Napi::Value Blurple(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
BlurpleWorker* blurpleWorker = new BlurpleWorker(cb, in_path, type, delay);
BlurpleWorker* blurpleWorker = new BlurpleWorker(cb, path, type, delay);
blurpleWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class CaptionWorker : public Napi::AsyncWorker {
~CaptionWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> captioned;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> captioned;
list <Image> result;
Blob caption_blob;
readImages(&frames, in_path);
@ -34,7 +34,7 @@ class CaptionWorker : public Napi::AsyncWorker {
for (Image &image : coalesced) {
Image appended;
list<Image> images;
list <Image> images;
image.backgroundColor("white");
images.push_back(caption_image);
images.push_back(image);
@ -62,13 +62,14 @@ Napi::Value Caption(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string caption = info[0].As<Napi::String>().Utf8Value();
string in_path = info[1].As<Napi::String>().Utf8Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string caption = obj.Get("caption").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
CaptionWorker* captionWorker = new CaptionWorker(cb, caption, in_path, type, delay);
CaptionWorker* captionWorker = new CaptionWorker(cb, caption, path, type, delay);
captionWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
~CaptionTwoWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> captioned;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> captioned;
list <Image> result;
Blob caption_blob;
readImages(&frames, in_path);
@ -32,7 +32,7 @@ class CaptionTwoWorker : public Napi::AsyncWorker {
for (Image &image : coalesced) {
Image appended;
list<Image> images;
list <Image> images;
image.backgroundColor("white");
images.push_back(image);
images.push_back(caption_image);
@ -60,13 +60,14 @@ Napi::Value CaptionTwo(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string caption = info[0].As<Napi::String>().Utf8Value();
string in_path = info[1].As<Napi::String>().Utf8Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string caption = obj.Get("caption").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
CaptionTwoWorker* captionTwoWorker = new CaptionTwoWorker(cb, caption, in_path, type, delay);
CaptionTwoWorker* captionTwoWorker = new CaptionTwoWorker(cb, caption, path, type, delay);
captionTwoWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class CircleWorker : public Napi::AsyncWorker {
~CircleWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> blurred;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> blurred;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -44,12 +44,13 @@ Napi::Value Circle(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
CircleWorker* circleWorker = new CircleWorker(cb, in_path, type, delay);
CircleWorker* circleWorker = new CircleWorker(cb, path, type, delay);
circleWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class CropWorker : public Napi::AsyncWorker {
~CropWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -45,12 +45,13 @@ Napi::Value Crop(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
CropWorker* blurWorker = new CropWorker(cb, in_path, type, delay);
CropWorker* blurWorker = new CropWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -44,13 +44,14 @@ Napi::Value Explode(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
int amount = info[1].As<Napi::Number>().Int32Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
int amount = obj.Get("amount").As<Napi::Number>().Int32Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
ExplodeWorker* explodeWorker = new ExplodeWorker(cb, in_path, amount, type, delay);
ExplodeWorker* explodeWorker = new ExplodeWorker(cb, path, amount, type, delay);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class FlagWorker : public Napi::AsyncWorker {
~FlagWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read(overlay_path);
@ -50,13 +50,14 @@ Napi::Value Flag(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string overlay_path = info[1].As<Napi::String>().Utf8Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string overlay = obj.Get("overlay").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
FlagWorker* flagWorker = new FlagWorker(cb, in_path, overlay_path, type, delay);
FlagWorker* flagWorker = new FlagWorker(cb, path, overlay, type, delay);
flagWorker->Queue();
return env.Undefined();
}

View File

@ -7,20 +7,20 @@ using namespace Magick;
class FlipWorker : public Napi::AsyncWorker {
public:
FlipWorker(Napi::Function& callback, string in_path, string type, int delay)
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
FlipWorker(Napi::Function& callback, string in_path, bool flop, string type, int delay)
: Napi::AsyncWorker(callback), in_path(in_path), flop(flop), type(type), delay(delay) {}
~FlipWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
image.flip();
flop ? image.flop() : image.flip();
image.magick(type);
mid.push_back(image);
}
@ -36,6 +36,7 @@ class FlipWorker : public Napi::AsyncWorker {
private:
string in_path, type;
bool flop;
int delay;
Blob blob;
};
@ -44,12 +45,14 @@ Napi::Value Flip(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool flop = obj.Has("flop") ? obj.Get("flop").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
FlipWorker* flipWorker = new FlipWorker(cb, in_path, type, delay);
FlipWorker* flipWorker = new FlipWorker(cb, path, flop, type, delay);
flipWorker->Queue();
return env.Undefined();
}

View File

@ -1,55 +0,0 @@
#include <napi.h>
#include <list>
#include <Magick++.h>
using namespace std;
using namespace Magick;
class FlopWorker : public Napi::AsyncWorker {
public:
FlopWorker(Napi::Function& callback, string in_path, string type, int delay)
: Napi::AsyncWorker(callback), in_path(in_path), type(type), delay(delay) {}
~FlopWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
image.flop();
image.magick(type);
mid.push_back(image);
}
optimizeImageLayers(&result, mid.begin(), mid.end());
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
writeImages(result.begin(), result.end(), &blob);
}
void OnOK() {
Callback().Call({Env().Undefined(), Napi::Buffer<char>::Copy(Env(), (char *)blob.data(), blob.length())});
}
private:
string in_path, type;
int delay;
Blob blob;
};
Napi::Value Flop(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
FlopWorker* flopWorker = new FlopWorker(cb, in_path, type, delay);
flopWorker->Queue();
return env.Undefined();
}

View File

@ -1,8 +0,0 @@
#ifndef ESMBOT_NATIVES_FLOP_H_
#define ESMBOT_NATIVES_FLOP_H_
#include <napi.h>
Napi::Value Flop(const Napi::CallbackInfo& info);
#endif

View File

@ -12,7 +12,7 @@ class FreezeWorker : public Napi::AsyncWorker {
~FreezeWorker() {}
void Execute() {
list<Image> frames;
list <Image> frames;
readImages(&frames, in_path);
for_each(frames.begin(), frames.end(), animationIterationsImage(loop ? 0 : 1));
@ -36,13 +36,14 @@ Napi::Value Freeze(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool loop = info[1].As<Napi::Boolean>().Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool loop = obj.Has("loop") ? obj.Get("loop").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
FreezeWorker* blurWorker = new FreezeWorker(cb, in_path, loop, type, delay);
FreezeWorker* blurWorker = new FreezeWorker(cb, path, loop, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class GamexplainWorker : public Napi::AsyncWorker {
~GamexplainWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read("./assets/images/gamexplain.png");
@ -49,12 +49,13 @@ Napi::Value Gamexplain(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
GamexplainWorker* blurWorker = new GamexplainWorker(cb, in_path, type, delay);
GamexplainWorker* blurWorker = new GamexplainWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class GlobeWorker : public Napi::AsyncWorker {
~GlobeWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image distort;
Image overlay;
readImages(&frames, in_path);
@ -24,7 +24,7 @@ class GlobeWorker : public Napi::AsyncWorker {
coalesceImages(&coalesced, frames.begin(), frames.end());
if (type != "GIF") {
list<Image>::iterator it = coalesced.begin();
list <Image>::iterator it = coalesced.begin();
for (int i = 0; i < 29; ++i) {
coalesced.push_back(*it);
}
@ -66,12 +66,13 @@ Napi::Value Globe(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
GlobeWorker* blurWorker = new GlobeWorker(cb, in_path, type, delay);
GlobeWorker* blurWorker = new GlobeWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -1,4 +1,5 @@
#include <napi.h>
#include <list>
#include <Magick++.h>
using namespace std;
@ -36,10 +37,11 @@ Napi::Value Homebrew(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string text = info[0].As<Napi::String>().Utf8Value();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string caption = obj.Get("caption").As<Napi::String>().Utf8Value();
HomebrewWorker* explodeWorker = new HomebrewWorker(cb, text);
HomebrewWorker* explodeWorker = new HomebrewWorker(cb, caption);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -1,4 +1,5 @@
#include <napi.h>
#include <list>
#include "blur.h"
#include "blurple.h"
#include "caption.h"
@ -8,7 +9,6 @@
#include "explode.h"
#include "flag.h"
#include "flip.h"
#include "flop.h"
#include "freeze.h"
#include "gamexplain.h"
#include "globe.h"
@ -45,7 +45,6 @@ Napi::Object Init(Napi::Env env, Napi::Object exports)
exports.Set(Napi::String::New(env, "explode"), Napi::Function::New(env, Explode));
exports.Set(Napi::String::New(env, "flag"), Napi::Function::New(env, Flag));
exports.Set(Napi::String::New(env, "flip"), Napi::Function::New(env, Flip));
exports.Set(Napi::String::New(env, "flop"), Napi::Function::New(env, Flop));
exports.Set(Napi::String::New(env, "freeze"), Napi::Function::New(env, Freeze));
exports.Set(Napi::String::New(env, "gamexplain"), Napi::Function::New(env, Gamexplain));
exports.Set(Napi::String::New(env, "globe"), Napi::Function::New(env, Globe));

View File

@ -12,20 +12,16 @@ class InvertWorker : public Napi::AsyncWorker {
~InvertWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> inverted;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
image.negateChannel(Magick::ChannelType(Magick::CompositeChannels ^ Magick::AlphaChannel));
image.magick(type);
inverted.push_back(image);
}
for_each(coalesced.begin(), coalesced.end(), negateImage(Magick::ChannelType(Magick::CompositeChannels ^ Magick::AlphaChannel)));
for_each(coalesced.begin(), coalesced.end(), magickImage(type));
optimizeImageLayers(&result, inverted.begin(), inverted.end());
optimizeImageLayers(&result, coalesced.begin(), coalesced.end());
if (delay != 0) for_each(result.begin(), result.end(), animationDelayImage(delay));
writeImages(result.begin(), result.end(), &blob);
}
@ -44,12 +40,13 @@ Napi::Value Invert(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
InvertWorker* invertWorker = new InvertWorker(cb, in_path, type, delay);
InvertWorker* invertWorker = new InvertWorker(cb, path, type, delay);
invertWorker->Queue();
return env.Undefined();
}

View File

@ -1,4 +1,5 @@
#include <napi.h>
#include <list>
#include <Magick++.h>
using namespace std;
@ -31,10 +32,11 @@ Napi::Value Jpeg(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
JpegWorker* explodeWorker = new JpegWorker(cb, in_path);
JpegWorker* explodeWorker = new JpegWorker(cb, path);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -12,9 +12,9 @@ class LeakWorker : public Napi::AsyncWorker {
~LeakWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
Image watermark;
readImages(&frames, in_path);
watermark.read("./assets/images/leak.png");
@ -48,12 +48,13 @@ Napi::Value Leak(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
LeakWorker* blurWorker = new LeakWorker(cb, in_path, type, delay);
LeakWorker* blurWorker = new LeakWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class MagikWorker : public Napi::AsyncWorker {
~MagikWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> blurred;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> blurred;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -46,12 +46,14 @@ Napi::Value Magik(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
MagikWorker* explodeWorker = new MagikWorker(cb, in_path, type, delay);
MagikWorker* explodeWorker = new MagikWorker(cb, path, type, delay);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -12,9 +12,9 @@ class MemeWorker : public Napi::AsyncWorker {
~MemeWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
Image top_text;
Image bottom_text;
readImages(&frames, in_path);
@ -74,14 +74,15 @@ Napi::Value Meme(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string text_top = info[1].As<Napi::String>().Utf8Value();
string text_bottom = info[2].As<Napi::String>().Utf8Value();
string type = info[3].As<Napi::String>().Utf8Value();
int delay = info[4].As<Napi::Number>().Int32Value();
Napi::Function cb = info[5].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string top = obj.Get("top").As<Napi::String>().Utf8Value();
string bottom = obj.Get("bottom").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
MemeWorker* blurWorker = new MemeWorker(cb, in_path, text_top, text_bottom, type, delay);
MemeWorker* blurWorker = new MemeWorker(cb, path, top, bottom, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class MirrorWorker : public Napi::AsyncWorker {
~MirrorWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
MagickCore::GravityType gravity;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -31,7 +31,7 @@ class MirrorWorker : public Napi::AsyncWorker {
}
for (Image &image : coalesced) {
list<Image> mirrored;
list <Image> mirrored;
Image final;
image.extent(Geometry(to_string(vertical ? image.baseColumns() : image.baseColumns() / 2) + "x" + to_string(vertical ? image.baseRows() / 2 : image.baseRows())), gravity);
mirrored.push_back(image);
@ -71,14 +71,15 @@ Napi::Value Mirror(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool vertical = info[1].As<Napi::Boolean>().Value();
bool first = info[2].As<Napi::Boolean>().Value();
string type = info[3].As<Napi::String>().Utf8Value();
int delay = info[4].As<Napi::Number>().Int32Value();
Napi::Function cb = info[5].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool vertical = obj.Has("vertical") ? obj.Get("vertical").As<Napi::Boolean>().Value() : false;
bool first = obj.Has("first") ? obj.Get("first").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
MirrorWorker* mirrorWorker = new MirrorWorker(cb, in_path, vertical, first, type, delay);
MirrorWorker* mirrorWorker = new MirrorWorker(cb, path, vertical, first, type, delay);
mirrorWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class SwirlWorker : public Napi::AsyncWorker {
~SwirlWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -44,12 +44,13 @@ Napi::Value Swirl(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
SwirlWorker* flopWorker = new SwirlWorker(cb, in_path, type, delay);
SwirlWorker* flopWorker = new SwirlWorker(cb, path, type, delay);
flopWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class MotivateWorker : public Napi::AsyncWorker {
~MotivateWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image top;
Image bottom;
readImages(&frames, in_path);
@ -49,7 +49,7 @@ class MotivateWorker : public Napi::AsyncWorker {
image.backgroundColor("black");
image.extent(Geometry(600, image.rows() + 50), Magick::CenterGravity);
list<Image> to_append;
list <Image> to_append;
to_append.push_back(image);
to_append.push_back(top);
if (bottom_text != "") to_append.push_back(bottom);
@ -77,14 +77,15 @@ Napi::Value Motivate(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string top_text = info[1].As<Napi::String>().Utf8Value();
string bottom_text = info[2].As<Napi::String>().Utf8Value();
string type = info[3].As<Napi::String>().Utf8Value();
int delay = info[4].As<Napi::Number>().Int32Value();
Napi::Function cb = info[5].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string top = obj.Get("top").As<Napi::String>().Utf8Value();
string bottom = obj.Get("bottom").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
MotivateWorker* blurWorker = new MotivateWorker(cb, in_path, top_text, bottom_text, type, delay);
MotivateWorker* blurWorker = new MotivateWorker(cb, path, top, bottom, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -1,4 +1,5 @@
#include <napi.h>
#include <list>
#include <ZXing/ReadBarcode.h>
#include <ZXing/TextUtfEncoding.h>
@ -42,10 +43,11 @@ Napi::Value QrRead(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
QrReadWorker* qrReadWorker = new QrReadWorker(cb, in_path);
QrReadWorker* qrReadWorker = new QrReadWorker(cb, path);
qrReadWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class ResizeWorker : public Napi::AsyncWorker {
~ResizeWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> blurred;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> blurred;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -52,14 +52,15 @@ Napi::Value Resize(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool stretch = info[1].As<Napi::Boolean>().Value();
bool wide = info[2].As<Napi::Boolean>().Value();
string type = info[3].As<Napi::String>().Utf8Value();
int delay = info[4].As<Napi::Number>().Int32Value();
Napi::Function cb = info[5].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool stretch = obj.Has("stretch") ? obj.Get("stretch").As<Napi::Boolean>().Value() : false;
bool wide = obj.Has("wide") ? obj.Get("wide").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
ResizeWorker* explodeWorker = new ResizeWorker(cb, in_path, stretch, wide, type, delay);
ResizeWorker* explodeWorker = new ResizeWorker(cb, path, stretch, wide, type, delay);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -1,5 +1,6 @@
#include <napi.h>
#include <list>
#include <list>
#include <Magick++.h>
using namespace std;
@ -46,12 +47,13 @@ Napi::Value Reverse(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool soos = info[1].As<Napi::Boolean>().Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool soos = obj.Has("soos") ? obj.Get("soos").As<Napi::Boolean>().Value() : false;
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
ReverseWorker* explodeWorker = new ReverseWorker(cb, in_path, soos, delay);
ReverseWorker* explodeWorker = new ReverseWorker(cb, path, soos, delay);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class ScottWorker : public Napi::AsyncWorker {
~ScottWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read("./assets/images/scott.png");
@ -53,12 +53,13 @@ Napi::Value Scott(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
ScottWorker* blurWorker = new ScottWorker(cb, in_path, type, delay);
ScottWorker* blurWorker = new ScottWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -41,8 +41,9 @@ Napi::Value Sonic(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string text = info[0].As<Napi::String>().Utf8Value();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string text = obj.Get("path").As<Napi::String>().Utf8Value();
SonicWorker* explodeWorker = new SonicWorker(cb, text);
explodeWorker->Queue();

View File

@ -12,8 +12,8 @@ class SpeedWorker : public Napi::AsyncWorker {
~SpeedWorker() {}
void Execute() {
list<Image> frames;
list<Image> blurred;
list <Image> frames;
list <Image> blurred;
readImages(&frames, in_path);
int new_delay = slow ? delay * 2 : delay / 2;
@ -43,13 +43,14 @@ Napi::Value Speed(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
bool slow = info[1].As<Napi::Boolean>().Value();
string type = info[2].As<Napi::String>().Utf8Value();
int delay = info[3].As<Napi::Number>().Int32Value();
Napi::Function cb = info[4].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
bool slow = obj.Has("slow") ? obj.Get("slow").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
SpeedWorker* explodeWorker = new SpeedWorker(cb, in_path, slow, type, delay);
SpeedWorker* explodeWorker = new SpeedWorker(cb, path, slow, type, delay);
explodeWorker->Queue();
return env.Undefined();
}

View File

@ -12,15 +12,15 @@ class SpinWorker : public Napi::AsyncWorker {
~SpinWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
if (type != "GIF") {
list<Image>::iterator it = coalesced.begin();
list <Image>::iterator it = coalesced.begin();
for (int i = 0; i < 29; ++i) {
coalesced.push_back(*it);
}
@ -60,12 +60,13 @@ Napi::Value Spin(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
SpinWorker* blurWorker = new SpinWorker(cb, in_path, type, delay);
SpinWorker* blurWorker = new SpinWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,17 +12,17 @@ class TileWorker : public Napi::AsyncWorker {
~TileWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
for (Image &image : coalesced) {
list<Image> duplicated;
list <Image> duplicated;
Image appended;
list<Image> montage;
list <Image> montage;
Image frame;
image.magick(type);
for (int i = 0; i < 5; ++i) {
@ -56,12 +56,13 @@ Napi::Value Tile(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
TileWorker* flopWorker = new TileWorker(cb, in_path, type, delay);
TileWorker* flopWorker = new TileWorker(cb, path, type, delay);
flopWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class TrumpWorker : public Napi::AsyncWorker {
~TrumpWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read("./assets/images/trump.png");
@ -53,12 +53,13 @@ Napi::Value Trump(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
TrumpWorker* blurWorker = new TrumpWorker(cb, in_path, type, delay);
TrumpWorker* blurWorker = new TrumpWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class WallWorker : public Napi::AsyncWorker {
~WallWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
readImages(&frames, in_path);
coalesceImages(&coalesced, frames.begin(), frames.end());
@ -50,12 +50,13 @@ Napi::Value Wall(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
WallWorker* flopWorker = new WallWorker(cb, in_path, type, delay);
WallWorker* flopWorker = new WallWorker(cb, path, type, delay);
flopWorker->Queue();
return env.Undefined();
}

View File

@ -1,5 +1,6 @@
#include <napi.h>
#include <list>
#include <iostream>
#include <Magick++.h>
using namespace std;
@ -7,15 +8,15 @@ using namespace Magick;
class WatermarkWorker : public Napi::AsyncWorker {
public:
WatermarkWorker(Napi::Function& callback, string in_path, string water_path, int gravity, bool resize, bool append, bool mc, string type, int delay)
: Napi::AsyncWorker(callback), in_path(in_path), water_path(water_path), gravity(gravity), resize(resize), append(append), mc(mc), type(type), delay(delay) {}
WatermarkWorker(Napi::Function& callback, string in_path, string water_path, int gravity, string type, int delay, bool resize, bool append, bool mc)
: Napi::AsyncWorker(callback), in_path(in_path), water_path(water_path), gravity(gravity), type(type), delay(delay), resize(resize), append(append), mc(mc) {}
~WatermarkWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read(water_path);
@ -31,7 +32,7 @@ class WatermarkWorker : public Napi::AsyncWorker {
for (Image &image : coalesced) {
Image final;
if (append) {
list<Image> to_append;
list <Image> to_append;
to_append.push_back(image);
to_append.push_back(watermark);
appendImages(&final, to_append.begin(), to_append.end(), true);
@ -68,17 +69,18 @@ Napi::Value Watermark(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string water = info[1].As<Napi::String>().Utf8Value();
int gravity = info[2].As<Napi::Number>().Int32Value();
bool resize = info[3].As<Napi::Boolean>().Value();
bool append = info[4].As<Napi::Boolean>().Value();
bool mc = info[5].As<Napi::Boolean>().Value();
string type = info[6].As<Napi::String>().Utf8Value();
int delay = info[7].As<Napi::Number>().Int32Value();
Napi::Function cb = info[8].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string water = obj.Get("water").As<Napi::String>().Utf8Value();
int gravity = obj.Get("gravity").As<Napi::Number>().Int32Value();
bool resize = obj.Has("resize") ? obj.Get("resize").As<Napi::Boolean>().Value() : false;
bool append = obj.Has("append") ? obj.Get("append").As<Napi::Boolean>().Value() : false;
bool mc = obj.Has("mc") ? obj.Get("mc").As<Napi::Boolean>().Value() : false;
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
WatermarkWorker* watermarkWorker = new WatermarkWorker(cb, in_path, water, gravity, resize, append, mc, type, delay);
WatermarkWorker* watermarkWorker = new WatermarkWorker(cb, path, water, gravity, type, delay, resize, append, mc);
watermarkWorker->Queue();
return env.Undefined();
}

View File

@ -12,10 +12,10 @@ class WdtWorker : public Napi::AsyncWorker {
~WdtWorker() {}
void Execute() {
list<Image> frames;
list<Image> coalesced;
list<Image> mid;
list<Image> result;
list <Image> frames;
list <Image> coalesced;
list <Image> mid;
list <Image> result;
Image watermark;
readImages(&frames, in_path);
watermark.read("./assets/images/whodidthis.png");
@ -48,12 +48,13 @@ Napi::Value Wdt(const Napi::CallbackInfo &info)
{
Napi::Env env = info.Env();
string in_path = info[0].As<Napi::String>().Utf8Value();
string type = info[1].As<Napi::String>().Utf8Value();
int delay = info[2].As<Napi::Number>().Int32Value();
Napi::Function cb = info[3].As<Napi::Function>();
Napi::Object obj = info[0].As<Napi::Object>();
Napi::Function cb = info[1].As<Napi::Function>();
string path = obj.Get("path").As<Napi::String>().Utf8Value();
string type = obj.Get("type").As<Napi::String>().Utf8Value();
int delay = obj.Get("delay").As<Napi::Number>().Int32Value();
WdtWorker* blurWorker = new WdtWorker(cb, in_path, type, delay);
WdtWorker* blurWorker = new WdtWorker(cb, path, type, delay);
blurWorker->Queue();
return env.Undefined();
}

584
package-lock.json generated
View File

@ -81,6 +81,16 @@
"event-target-shim": "^5.0.0"
}
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"optional": true,
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"acorn": {
"version": "6.4.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
@ -129,6 +139,12 @@
"color-convert": "^1.9.0"
}
},
"append-field": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",
"integrity": "sha1-HjRA6RXwsSA9I3SOeO3XubW0PlY=",
"optional": true
},
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@ -138,6 +154,12 @@
"sprintf-js": "~1.0.2"
}
},
"array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=",
"optional": true
},
"astral-regex": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz",
@ -192,6 +214,41 @@
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
"integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
"optional": true,
"requires": {
"bytes": "3.1.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"on-finished": "~2.3.0",
"qs": "6.7.0",
"raw-body": "2.4.0",
"type-is": "~1.6.17"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"optional": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"optional": true
}
}
},
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
@ -258,6 +315,48 @@
"node-gyp-build": "~3.7.0"
}
},
"busboy": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-0.2.14.tgz",
"integrity": "sha1-bCpiLvz0fFe7vh4qnDetNseSVFM=",
"optional": true,
"requires": {
"dicer": "0.2.5",
"readable-stream": "1.1.x"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"optional": true
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"optional": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"optional": true
}
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==",
"optional": true
},
"callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@ -456,6 +555,33 @@
}
}
},
"content-disposition": {
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
"optional": true,
"requires": {
"safe-buffer": "5.1.2"
}
},
"content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
"optional": true
},
"cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==",
"optional": true
},
"cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=",
"optional": true
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -472,14 +598,6 @@
"strip-eof": "^1.0.0"
}
},
"cron": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/cron/-/cron-1.8.2.tgz",
"integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==",
"requires": {
"moment-timezone": "^0.5.x"
}
},
"css-select": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz",
@ -530,6 +648,54 @@
"resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
"integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
},
"depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
"optional": true
},
"destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=",
"optional": true
},
"dicer": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/dicer/-/dicer-0.2.5.tgz",
"integrity": "sha1-WZbAhrszIYyBLAkL3cCc0S+stw8=",
"optional": true,
"requires": {
"readable-stream": "1.1.x",
"streamsearch": "0.1.2"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"optional": true
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
"optional": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"string_decoder": {
"version": "0.10.31",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
"optional": true
}
}
},
"dijkstrajs": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.1.tgz",
@ -587,6 +753,12 @@
"axios": "^0.18.0"
}
},
"ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"optional": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
@ -597,6 +769,12 @@
"resolved": "https://registry.npmjs.org/enabled/-/enabled-2.0.0.tgz",
"integrity": "sha512-AKrN98kuwOzMIdAizXGI86UFBoo26CL21UM763y1h/GMSJ4/OHU9k2YlsmBpyScFo/wbLzWQJBMCW4+IO3/+OQ=="
},
"encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
"optional": true
},
"entities": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz",
@ -621,6 +799,12 @@
"nan": "^2.14.0"
}
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=",
"optional": true
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
@ -773,11 +957,72 @@
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true
},
"etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
"optional": true
},
"event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
},
"express": {
"version": "4.17.1",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz",
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
"optional": true,
"requires": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.0",
"content-disposition": "0.5.3",
"content-type": "~1.0.4",
"cookie": "0.4.0",
"cookie-signature": "1.0.6",
"debug": "2.6.9",
"depd": "~1.1.2",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"finalhandler": "~1.1.2",
"fresh": "0.5.2",
"merge-descriptors": "1.0.1",
"methods": "~1.1.2",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"path-to-regexp": "0.1.7",
"proxy-addr": "~2.0.5",
"qs": "6.7.0",
"range-parser": "~1.2.1",
"safe-buffer": "5.1.2",
"send": "0.17.1",
"serve-static": "1.14.1",
"setprototypeof": "1.1.1",
"statuses": "~1.5.0",
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"optional": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"optional": true
}
}
},
"external-editor": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz",
@ -897,6 +1142,38 @@
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
"optional": true
},
"finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"optional": true,
"requires": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"on-finished": "~2.3.0",
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"optional": true,
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"optional": true
}
}
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
@ -960,6 +1237,18 @@
"mime-types": "^2.1.12"
}
},
"forwarded": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=",
"optional": true
},
"fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
"optional": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -1031,6 +1320,19 @@
}
}
},
"http-errors": {
"version": "1.7.2",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz",
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
"optional": true,
"requires": {
"depd": "~1.1.2",
"inherits": "2.0.3",
"setprototypeof": "1.1.1",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.0"
}
},
"https-proxy-agent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz",
@ -1054,7 +1356,6 @@
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dev": true,
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
@ -1100,12 +1401,6 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"optional": true
},
"inquirer": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.3.1.tgz",
@ -1144,6 +1439,12 @@
}
}
},
"ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"optional": true
},
"is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
@ -1281,12 +1582,36 @@
"triple-beam": "^1.3.0"
}
},
"media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"optional": true
},
"memory-pager": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
"optional": true
},
"merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=",
"optional": true
},
"methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
"optional": true
},
"mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"optional": true
},
"mime-db": {
"version": "1.42.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz",
@ -1338,14 +1663,6 @@
"resolved": "https://registry.npmjs.org/moment-duration-format/-/moment-duration-format-2.3.2.tgz",
"integrity": "sha512-cBMXjSW+fjOb4tyaVHuaVE/A5TqkukDWiOfxxAjY+PEqmmBQlLwn+8OzwPiG3brouXKY5Un4pBjAeB6UToXHaQ=="
},
"moment-timezone": {
"version": "0.5.31",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz",
"integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==",
"requires": {
"moment": ">= 2.9.0"
}
},
"mongodb": {
"version": "3.5.9",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.9.tgz",
@ -1442,6 +1759,22 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"multer": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/multer/-/multer-1.4.2.tgz",
"integrity": "sha512-xY8pX7V+ybyUpbYMxtjM9KAiD9ixtg5/JkeKUTD6xilfDv0vzzOFcCp4Ljb1UU3tSOM3VTZtKo63OmzOrGi3Cg==",
"optional": true,
"requires": {
"append-field": "^1.0.0",
"busboy": "^0.2.11",
"concat-stream": "^1.5.2",
"mkdirp": "^0.5.1",
"object-assign": "^4.1.1",
"on-finished": "^2.3.0",
"type-is": "^1.6.4",
"xtend": "^4.0.0"
}
},
"mute-stream": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
@ -1460,6 +1793,12 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
"optional": true
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
@ -1503,6 +1842,21 @@
"boolbase": "~1.0.0"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"optional": true
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"optional": true,
"requires": {
"ee-first": "1.1.1"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@ -1617,6 +1971,12 @@
"@types/node": "*"
}
},
"parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"optional": true
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
@ -1639,6 +1999,12 @@
"integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=",
"dev": true
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
"optional": true
},
"peek-readable": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/peek-readable/-/peek-readable-3.1.0.tgz",
@ -1670,6 +2036,16 @@
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA=="
},
"proxy-addr": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
"integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
"optional": true,
"requires": {
"forwarded": "~0.1.2",
"ipaddr.js": "1.9.1"
}
},
"proxy-from-env": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz",
@ -1735,6 +2111,30 @@
"yargs": "^13.2.4"
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==",
"optional": true
},
"range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"optional": true
},
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
"optional": true,
"requires": {
"bytes": "3.1.0",
"http-errors": "1.7.2",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
}
},
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@ -1857,8 +2257,7 @@
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"saslprep": {
"version": "1.0.3",
@ -1874,11 +2273,69 @@
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA=="
},
"send": {
"version": "0.17.1",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz",
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
"optional": true,
"requires": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"etag": "~1.8.1",
"fresh": "0.5.2",
"http-errors": "~1.7.2",
"mime": "1.6.0",
"ms": "2.1.1",
"on-finished": "~2.3.0",
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"optional": true,
"requires": {
"ms": "2.0.0"
},
"dependencies": {
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"optional": true
}
}
}
}
},
"serve-static": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz",
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
"optional": true,
"requires": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.1"
}
},
"set-blocking": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
},
"setprototypeof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz",
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==",
"optional": true
},
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@ -1929,31 +2386,6 @@
"resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz",
"integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E="
},
"sodium-native": {
"version": "2.4.6",
"resolved": "https://registry.npmjs.org/sodium-native/-/sodium-native-2.4.6.tgz",
"integrity": "sha512-Ro9lhTjot8M01nwKLXiqLSmjR7B8o+Wg4HmJUjEShw/q6XPlNMzjPkA1VJKaMH8SO8fJ/sggAKVwreTaFszS2Q==",
"optional": true,
"requires": {
"ini": "^1.3.5",
"nan": "^2.14.0",
"node-gyp-build": "^4.1.0"
},
"dependencies": {
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==",
"optional": true
},
"node-gyp-build": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.0.tgz",
"integrity": "sha512-4oiumOLhCDU9Rronz8PZ5S4IvT39H5+JEv/hps9V8s7RSLhsac0TCP78ulnHXOo8X1wdpPiTayGlM1jr4IbnaQ==",
"optional": true
}
}
},
"sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
@ -1974,6 +2406,18 @@
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
},
"statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
"optional": true
},
"streamsearch": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz",
"integrity": "sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=",
"optional": true
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
@ -2094,6 +2538,12 @@
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=",
"dev": true
},
"toidentifier": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz",
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==",
"optional": true
},
"token-types": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/token-types/-/token-types-2.0.0.tgz",
@ -2129,6 +2579,16 @@
"prelude-ls": "~1.1.2"
}
},
"type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"optional": true,
"requires": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
}
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
@ -2142,6 +2602,12 @@
"is-typedarray": "^1.0.0"
}
},
"unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
"optional": true
},
"uri-js": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz",
@ -2156,6 +2622,18 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"optional": true
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"optional": true
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
@ -2273,6 +2751,12 @@
"resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz",
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA=="
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
"integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==",
"optional": true
},
"y18n": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz",

7
utils/image.js Normal file
View File

@ -0,0 +1,7 @@
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
module.exports = async (object) => {
const data = await promisify(magick[object.cmd])(object);
return data;
};