Skip to content

Commit

Permalink
Revert attempt to fix #122
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Aug 30, 2021
1 parent 4c71cfd commit e87f3da
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions img.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit e87f3da

Please sign in to comment.