MCPcopy Create free account
hub / github.com/GrapesJS/cli / writeFile

Function writeFile

src/utils.ts:90–102  ·  view source on GitHub ↗
(filePath: string, data: string)

Source from the content-addressed store, hash-verified

88
89
90export const writeFile = async (filePath: string, data: string) => {
91 try {
92 const dirname = path.dirname(filePath);
93 const exist = await isPathExists(dirname);
94 if (!exist) {
95 await fsp.mkdir(dirname, { recursive: true });
96 }
97
98 await fsp.writeFile(filePath, data, 'utf8');
99 } catch (err) {
100 throw new Error(err);
101 }
102}
103
104export const rootResolve = (val: string) => path.resolve(process.cwd(), val);
105

Callers 1

buildDeclarationFunction · 0.90

Calls 1

isPathExistsFunction · 0.85

Tested by

no test coverage detected