Use gif-encoder-2

This commit is contained in:
Dragon Fire
2024-04-25 00:47:30 -04:00
parent b7eacc98d4
commit 3eed5c373b
8 changed files with 21 additions and 60 deletions
-29
View File
@@ -137,35 +137,6 @@ module.exports = class Util {
return a;
}
static streamToArray(stream) {
if (!stream.readable) return Promise.resolve([]);
return new Promise((resolve, reject) => {
const array = [];
function onData(data) {
array.push(data);
}
function onEnd(error) {
if (error) reject(error);
else resolve(array);
cleanup();
}
function onClose() {
resolve(array);
cleanup();
}
function cleanup() {
stream.removeListener('data', onData);
stream.removeListener('end', onEnd);
stream.removeListener('error', onEnd);
stream.removeListener('close', onClose);
}
stream.on('data', onData);
stream.on('end', onEnd);
stream.on('error', onEnd);
stream.on('close', onClose);
});
}
static percentColor(pct, percentColors) {
let i = 1;
for (i; i < percentColors.length - 1; i++) {