diff --git a/package.json b/package.json index 81ce77f..7ed37b4 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "ava": "^6.2.0", "eslint": "^9.17.0", "globals": "^15.14.0", + "graceful-fs": "^4.2.11", "pixelmatch": "^5.3.0" }, "ava": { diff --git a/src/image.js b/src/image.js index b1dc94f..b512266 100644 --- a/src/image.js +++ b/src/image.js @@ -115,7 +115,7 @@ class Image { opts.sourceUrl = this.src.toString(); opts.__originalSize = this.src.length; } else { - // TODO @zachleat (multiread): another read + // Important: do not cache this opts.__originalSize = fs.statSync(this.src).size; } @@ -143,7 +143,6 @@ class Image { } } - return this.#contents[src]; } @@ -300,7 +299,6 @@ class Image { // fetch remote image Buffer this.inputPromise = this.assetCache.queue(); } else { - // TODO @zachleat (multiread): read local file contents here and always return a buffer this.inputPromise = Promise.resolve(this.src); } } diff --git a/test/test.js b/test/test.js index 4400259..1142472 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ const path = require("node:path"); -const fs = require("node:fs"); +const fs = require("graceful-fs"); const { URL } = require("node:url"); const test = require("ava");