MCPcopy Create free account
hub / github.com/lowdefy/lowdefy / writeFile

Function writeFile

packages/utils/node-utils/src/writeFile.js:25–40  ·  view source on GitHub ↗
(filePath, content)

Source from the content-addressed store, hash-verified

23const writeFilePromise = promisify(fs.writeFile);
24
25async function writeFile(filePath, content) {
26 if (!type.isString(filePath)) {
27 throw new Error('Could not write file, file path should be a string.');
28 }
29
30 try {
31 await writeFilePromise(path.resolve(filePath), content);
32 } catch (error) {
33 if (error.code === 'ENOENT') {
34 await mkdirPromise(path.dirname(filePath), { recursive: true });
35 await writeFilePromise(filePath, content);
36 return;
37 }
38 throw error;
39 }
40}
41
42export default writeFile;

Callers 7

addCustomPluginsAsDepsFunction · 0.90
getCliJsonFunction · 0.90
initFunction · 0.90
initVercelFunction · 0.90
initDockerFunction · 0.90
reloadClientsFunction · 0.90
writeFile.test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected