From e87f3da1bf730a4905444f970850601849f41c56 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Sun, 29 Aug 2021 20:58:46 -0500 Subject: [PATCH] Revert attempt to fix #122 --- img.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/img.js b/img.js index 336a11f..a9d0926 100644 --- a/img.js +++ b/img.js @@ -180,17 +180,12 @@ class Image { } // format is only required for local files - static getHash(src, format, options = {}, length = 10) { + static getHash(src, options = {}, length = 10) { let hash = createHash("sha256"); if(fs.existsSync(src)) { - let encoding = null; - if(format === "svg") { - encoding = "utf8"; - } - // TODO probably need a cache here - let fileContent = fs.readFileSync(src, { encoding }); + let fileContent = fs.readFileSync(src); hash.update(fileContent); } else { // probably a remote URL @@ -471,7 +466,7 @@ class ImageStat { let outputFilename; let outputExtension = options.extensions[format] || format; - let id = Image.getHash(src, format, options); + let id = Image.getHash(src, options); if(options.urlFormat && typeof options.urlFormat === "function") { url = options.urlFormat({