MCPcopy Create free account
hub / github.com/tiann/hapi / copyAssetFile

Function copyAssetFile

cli/src/runtime/assets.ts:19–34  ·  view source on GitHub ↗
(asset: EmbeddedAsset, targetPath: string)

Source from the content-addressed store, hash-verified

17}).Bun;
18
19async function copyAssetFile(asset: EmbeddedAsset, targetPath: string): Promise<void> {
20 ensureDirectory(dirname(targetPath));
21 if (bunRuntime) {
22 const data = await bunRuntime.file(asset.sourcePath).arrayBuffer();
23 writeFileSync(targetPath, Buffer.from(data));
24 return;
25 }
26
27 copyFileSync(asset.sourcePath, targetPath);
28 try {
29 const stats = statSync(asset.sourcePath);
30 chmodSync(targetPath, stats.mode);
31 } catch {
32 // Best-effort; permission adjustments are not critical.
33 }
34}
35
36function getPlatformDir(): string {
37 const platformName = platform();

Callers 1

ensureRuntimeAssetsFunction · 0.85

Calls 1

ensureDirectoryFunction · 0.85

Tested by

no test coverage detected