MCPcopy Create free account
hub / github.com/code-pushup/cli / flush

Function flush

packages/utils/src/lib/wizard/virtual-fs.ts:72–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70 })),
71
72 async flush(): Promise<void> {
73 const written = new Set<string>();
74 try {
75 await [...pending.entries()].reduce<Promise<null>>(
76 async (acc, [filePath, { content }]) => {
77 await acc;
78 const absolutePath = resolve(filePath);
79 await fs.mkdir(path.dirname(absolutePath), { recursive: true });
80 await fs.writeFile(absolutePath, content);
81 written.add(filePath);
82 return null;
83 },
84 Promise.resolve(null),
85 );
86 pending.clear();
87 } catch (error) {
88 await rollback([...written], pending, fs, resolve);
89 throw error;
90 }
91 },
92 };
93}
94

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.85
rollbackFunction · 0.85

Tested by

no test coverage detected