MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / edit

Method edit

daemon/src/service/system_file.ts:290–302  ·  view source on GitHub ↗
(target: string, data?: string)

Source from the content-addressed store, hash-verified

288 }
289
290 async edit(target: string, data?: string) {
291 if (!this.check(target)) throw new Error(ERROR_MSG_01);
292 if (data || typeof data === "string") {
293 return await this.writeFile(target, data);
294 } else {
295 const absPath = this.toAbsolutePath(target);
296 const info = fs.statSync(absPath);
297 if (info.size > MAX_EDIT_SIZE) {
298 throw new Error($t("TXT_CODE_system_file.execLimit"));
299 }
300 return await this.readFile(target);
301 }
302 }
303
304 rename(target: string, newName: string) {
305 if (!this.check(target)) throw new Error(ERROR_MSG_01);

Callers 1

file_router.tsFile · 0.45

Calls 5

checkMethod · 0.95
writeFileMethod · 0.95
toAbsolutePathMethod · 0.95
readFileMethod · 0.95
$tFunction · 0.90

Tested by

no test coverage detected