diff --git a/src/FileCache.js b/src/FileCache.js index ca6c7c2..9d548ab 100644 --- a/src/FileCache.js +++ b/src/FileCache.js @@ -188,7 +188,7 @@ class FileCache { // have to read the entire contents via JSON.parse (or otherwise) to check the cache validity. this.#counts.read++; let type = metadata?.type || this.getType(); - let data = fs.readFileSync(this.contentsPath); + let data = fs.readFileSync(this.contentsPath, type !== "buffer" ? "utf8" : null); if (type === "json" || type === "parsed-xml") { data = JSON.parse(data); }