MCPcopy Index your code
hub / github.com/Create-Node-App/create-node-app / writeFile

Function writeFile

src/loaders.js:22–38  ·  view source on GitHub ↗
(path, content, flag = 'w', verbose)

Source from the content-addressed store, hash-verified

20}
21
22function writeFile(path, content, flag = 'w', verbose) {
23 try {
24 const parentDir = dirname(path);
25 if (parentDir) {
26 fs.mkdirSync(parentDir, { recursive: true });
27 }
28 fs.writeFileSync(path, content, { flag });
29 if (verbose) {
30 console.log(chalk.green(`Added "${path}" successfully`));
31 }
32 } catch (err) {
33 console.log(chalk.red(`Cannot write file ${path}`));
34 if (verbose) {
35 console.log(chalk.red(err));
36 }
37 }
38}
39
40function appendFile(src, dest, verbose) {
41 const content = fs.readFileSync(src, 'utf8');

Callers 2

appendFileFunction · 0.85
templateLoaderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected