MCPcopy
hub / github.com/electric-sql/pglite / copyFiles

Function copyFiles

packages/pglite-tools/scripts/bundle-wasm.ts:4–19  ·  view source on GitHub ↗
(srcDir: string, destDir: string)

Source from the content-addressed store, hash-verified

2import * as path from "path";
3
4const copyFiles = async (srcDir: string, destDir: string) => {
5 await fs.mkdir(destDir, { recursive: true });
6 const files = await fs.readdir(srcDir);
7 for (const file of files) {
8 if (file.startsWith(".")) {
9 continue;
10 }
11 const srcFile = path.join(srcDir, file);
12 const destFile = path.join(destDir, file);
13 const stat = await fs.stat(srcFile);
14 if (stat.isFile()) {
15 await fs.copyFile(srcFile, destFile);
16 console.log(`Copied ${srcFile} to ${destFile}`);
17 }
18 }
19};
20
21async function main() {
22 // pg_dump is not yet available from CI, so we download as precompiled

Callers 1

mainFunction · 0.70

Calls 4

mkdirMethod · 0.80
readdirMethod · 0.80
joinMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected