diff --git a/src/utils/matchImages.ts b/src/utils/matchImages.ts deleted file mode 100644 index 3c584a1..0000000 --- a/src/utils/matchImages.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { PNG } from "pngjs"; -import pixelmatch from "pixelmatch"; - -interface MatchImagesArgs { - img1Buff: Buffer; - img2Buff: Buffer; -} - -export const matchImages = ({ img1Buff, img2Buff }: MatchImagesArgs) => { - const img1 = PNG.sync.read(img1Buff); - const img2 = PNG.sync.read(img2Buff); - const { width, height } = img1; - - const diff = new PNG({ width, height }); - - return pixelmatch(img1.data, img2.data, diff.data, width, height, { - threshold: 0.1, - }); -}; diff --git a/src/utils/saveFrames.ts b/src/utils/saveFrames.ts deleted file mode 100644 index f3be527..0000000 --- a/src/utils/saveFrames.ts +++ /dev/null @@ -1,16 +0,0 @@ -import fs from "fs"; -import path from "path"; -import { bitmapsDir } from "../config"; - -export interface Frames { - [fileName: string]: { - buffer: Buffer; - }; -} - -export const saveFrames = (frames: Frames) => { - for (let [fileName, { buffer }] of Object.entries(frames)) { - const out_path = path.resolve(bitmapsDir, fileName); - fs.writeFileSync(out_path, buffer, { encoding: "binary" }); - } -}; diff --git a/src/utils/htmlTemplate.ts b/src/utils/toHTML.ts similarity index 77% rename from src/utils/htmlTemplate.ts rename to src/utils/toHTML.ts index 4224c27..e64ef19 100644 --- a/src/utils/htmlTemplate.ts +++ b/src/utils/toHTML.ts @@ -15,5 +15,5 @@ export const template = ` `; -export const htmlTemplate = (svg: string) => - template.replace("", svg); +export const toHTML = (svgData: string): string => + template.replace("", svgData);