MCPcopy Create free account
hub / github.com/alexankitty/Myrient-Search-Engine / saveJsonFile

Method saveJsonFile

lib/crawler/filehandler.js:15–26  ·  view source on GitHub ↗
(filePath, fileArr)

Source from the content-addressed store, hash-verified

13 }
14
15 static async saveJsonFile(filePath, fileArr) {
16 try {
17 // Ensure directory exists
18 await fs.promises.mkdir(path.dirname(filePath), { recursive: true });
19
20 let data = await JSON.stringify(fileArr);
21 await writeFile(filePath, data);
22 console.log(`Successfully saved file list to ${filePath}.`);
23 } catch (err) {
24 console.error(err);
25 }
26 }
27
28 static fileExists(filePath) {
29 return fs.existsSync(filePath);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected