MCPcopy
hub / github.com/mailvelope/mailvelope / getBytesInUse

Function getBytesInUse

test/integration/__mocks__/chrome-api-setup.js:368–383  ·  view source on GitHub ↗
(keys)

Source from the content-addressed store, hash-verified

366 },
367
368 async getBytesInUse(keys) {
369 let totalBytes = 0;
370 const keysToCheck = !keys ?
371 Array.from(storageMap.keys()) :
372 Array.isArray(keys) ? keys : [keys];
373
374 for (const key of keysToCheck) {
375 if (storageMap.has(key)) {
376 // Rough byte calculation - stringify and count UTF-16 code units
377 const serialized = JSON.stringify({[key]: storageMap.get(key)});
378 totalBytes += serialized.length * 2; // UTF-16 uses 2 bytes per character
379 }
380 }
381
382 return totalBytes;
383 },
384
385 async clear() {
386 storageMap.clear();

Callers

nothing calls this directly

Calls 2

hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected