MCPcopy Create free account
hub / github.com/Crain99/cc-reverse / writeFile

Function writeFile

src/utils/fileManager.js:74–99  ·  view source on GitHub ↗

* 写入文件 * @param {string} directory 目录名 * @param {string} filename 文件名 * @param {any} data 要写入的数据 * @returns {Promise }

(directory, filename, data)

Source from the content-addressed store, hash-verified

72
73 await fsp.writeFile(outputPath, content);
74
75 if (global.verbose) {
76 logger.debug(`写入文件: ${outputPath}`);
77 }
78 } catch (err) {
79 logger.error(`写入文件 ${directory}/${filename} 时出错:`, err);
80 throw err;
81 }
82 },
83
84 /**
85 * 创建元数据文件
86 * @param {Object<string, string>} fileMap 文件名 → uuid
87 * @returns {Promise<void>}
88 */
89 async createMetaFile(fileMap) {
90 try {
91 const entries = fileMap instanceof Map
92 ? [...fileMap.entries()]
93 : Object.entries(fileMap || {});
94
95 for (const [filename, uuid] of entries) {
96 const meta = {
97 ver: '1.0.8',
98 uuid,
99 isPlugin: false,
100 loadPluginInWeb: true,
101 loadPluginInNative: true,
102 loadPluginInEditor: false,

Callers 10

jsonToPlistFunction · 0.50
saveAstToFileFunction · 0.50
generateProjectFunction · 0.50
unpackAssetFunction · 0.50
decodeCconToDocFunction · 0.50
writeMetaFunction · 0.50
writeScriptMetaFunction · 0.50
writeProjectDescriptorFunction · 0.50
writeRecoveryReportFunction · 0.50
writeCocos2xProjectFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected