remove: this was re-implemented already in a much simpler way

pull/243/head
Josh Moore 8 months ago
parent 49a2e85b93
commit d3191c9970

@ -1,9 +1,7 @@
import fs from 'fs-extra';
import sharp from 'sharp';
import crypto from 'crypto';
import Vibrant from 'node-vibrant';
import ffmpeg from 'ffmpeg-static';
import toArray from 'stream-to-array';
import { exec } from 'child_process';
import { removeLocation } from '@xoi/gps-metadata-remover';
import { isProd } from '@tycrek/joint';
@ -31,16 +29,6 @@ export const removeGPS = (file: string): Promise<boolean> => {
.catch(reject));
}
/**
* SHA256 file hasher
*/
export const sha256 = (file: string): Promise<string> => new Promise((resolve, reject) =>
toArray(fs.createReadStream(file))
.then((parts: any[]) => Buffer.concat(parts.map((part: any) => Buffer.isBuffer(part) ? part : Buffer.from(part))))
.then((buf: Buffer) => crypto.createHash('sha256').update(buf).digest('hex'))
.then((hash: string) => resolve(hash))
.catch(reject));
const VIBRANT = { COLOURS: 256, QUALITY: 3 };
export const vibrant = (file: string, mimetype: string): Promise<string> => new Promise((resolve, reject) =>
// todo: random hex colour

Loading…
Cancel
Save