MCPcopy Index your code
hub / github.com/protomaps/PMTiles / getHeader

Method getHeader

js/src/index.ts:658–681  ·  view source on GitHub ↗
(source: Source)

Source from the content-addressed store, hash-verified

656 }
657
658 async getHeader(source: Source): Promise<Header> {
659 const cacheKey = source.getKey();
660 const cacheValue = this.cache.get(cacheKey);
661 if (cacheValue) {
662 cacheValue.lastUsed = this.counter++;
663 const data = cacheValue.data;
664 return data as Header;
665 }
666
667 const res = await getHeaderAndRoot(source, this.decompress);
668 if (res[1]) {
669 this.cache.set(res[1][0], {
670 lastUsed: this.counter++,
671 data: res[1][2],
672 });
673 }
674
675 this.cache.set(cacheKey, {
676 lastUsed: this.counter++,
677 data: res[0],
678 });
679 this.prune();
680 return res[0];
681 }
682
683 async getDirectory(
684 source: Source,

Callers

nothing calls this directly

Calls 4

pruneMethod · 0.95
getHeaderAndRootFunction · 0.85
getKeyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected