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

Method newFile

daemon/src/service/system_file.ts:221–228  ·  view source on GitHub ↗
(fileName: string)

Source from the content-addressed store, hash-verified

219 }
220
221 async newFile(fileName: string) {
222 // if (!FileManager.checkFileName(fileName)) throw new Error(ERROR_MSG_01);
223 if (!this.checkPath(fileName)) throw new Error(ERROR_MSG_01);
224 const target = this.toAbsolutePath(fileName);
225 const parentDir = path.resolve(path.dirname(target));
226 if (parentDir !== path.parse(parentDir).root) await fs.mkdir(parentDir, { recursive: true });
227 return await fs.createFile(target);
228 }
229
230 async copy(target1: string, target2: string) {
231 if (!this.checkPath(target2) || !this.check(target1)) throw new Error(ERROR_MSG_01);

Callers 1

file_router.tsFile · 0.80

Calls 3

checkPathMethod · 0.95
toAbsolutePathMethod · 0.95
mkdirMethod · 0.80

Tested by

no test coverage detected