MCPcopy
hub / github.com/Dokploy/dokploy / getCreateFileCommand

Function getCreateFileCommand

packages/server/src/utils/docker/utils.ts:708–724  ·  view source on GitHub ↗
(
	outputPath: string,
	filePath: string,
	content: string,
)

Source from the content-addressed store, hash-verified

706 Buffer.from(content, "utf-8").toString("base64");
707
708export const getCreateFileCommand = (
709 outputPath: string,
710 filePath: string,
711 content: string,
712) => {
713 const fullPath = path.join(outputPath, filePath);
714 if (fullPath.endsWith(path.sep) || filePath.endsWith("/")) {
715 return `mkdir -p ${fullPath};`;
716 }
717
718 const directory = path.dirname(fullPath);
719 const encodedContent = encodeBase64(content);
720 return `
721 mkdir -p ${directory};
722 echo "${encodedContent}" | base64 -d > "${fullPath}";
723 `;
724};
725
726export const getServiceContainer = async (
727 appName: string,

Callers 2

getStaticCommandFunction · 0.90
createFileMountFunction · 0.90

Calls 1

encodeBase64Function · 0.85

Tested by

no test coverage detected