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

Function createFile

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

Source from the content-addressed store, hash-verified

684};
685
686export const createFile = async (
687 outputPath: string,
688 filePath: string,
689 content: string,
690) => {
691 try {
692 const fullPath = path.join(outputPath, filePath);
693 if (fullPath.endsWith(path.sep) || filePath.endsWith("/")) {
694 fs.mkdirSync(fullPath, { recursive: true });
695 return;
696 }
697
698 const directory = path.dirname(fullPath);
699 fs.mkdirSync(directory, { recursive: true });
700 fs.writeFileSync(fullPath, content || "");
701 } catch (error) {
702 throw error;
703 }
704};
705export const encodeBase64 = (content: string) =>
706 Buffer.from(content, "utf-8").toString("base64");
707

Callers 1

createFileMountFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected