MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / _doAppendVersion

Method _doAppendVersion

packages/sdk/src/adapters/fs.ts:123–134  ·  view source on GitHub ↗
(path: string, content: string)

Source from the content-addressed store, hash-verified

121 }
122
123 private async _doAppendVersion(path: string, content: string): Promise<void> {
124 const dir = this.versionsDir(path);
125 await mkdir(dir, { recursive: true });
126 const key = `${Date.now()}-${String(++_versionCounter).padStart(4, "0")}`;
127 await writeFile(join(dir, `${key}.html`), content, "utf8");
128 // prune oldest beyond maxVersions
129 const all = (await readdir(dir)).filter((f) => f.endsWith(".html")).sort();
130 const excess = all.length - this.maxVersions;
131 if (excess > 0) {
132 await Promise.all(all.slice(0, excess).map((f) => unlink(join(dir, f)).catch(() => {})));
133 }
134 }
135}
136
137function isNotFound(err: unknown): boolean {

Callers 1

appendVersionMethod · 0.95

Calls 3

versionsDirMethod · 0.95
writeFileFunction · 0.85
nowMethod · 0.80

Tested by

no test coverage detected