MCPcopy
hub / github.com/streetwriters/notesnook / isBundleSame

Function isBundleSame

apps/desktop/scripts/dev.mjs:179–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177}
178
179async function isBundleSame() {
180 const bundle = Buffer.concat([
181 await fs.readFile(path.join(__dirname, "..", "build", "electron.js")),
182 await fs.readFile(path.join(__dirname, "..", "build", "preload.js"))
183 ]);
184
185 const hashSum = crypto.createHash("sha256");
186 hashSum.update(bundle);
187 const hex = hashSum.digest("hex");
188
189 if (!lastBundleHash) {
190 lastBundleHash = hex;
191 return false;
192 }
193 if (hex === lastBundleHash) return true;
194 lastBundleHash = hex;
195 return false;
196}

Callers 1

onChangeFunction · 0.85

Calls 2

readFileMethod · 0.65
updateMethod · 0.65

Tested by

no test coverage detected