MCPcopy
hub / github.com/remotely-save/remotely-save / mkdir

Method mkdir

pro/src/fsKoofr.ts:447–473  ·  view source on GitHub ↗
(
    key: string,
    mtime?: number | undefined,
    ctime?: number | undefined
  )

Source from the content-addressed store, hash-verified

445 }
446
447 async mkdir(
448 key: string,
449 mtime?: number | undefined,
450 ctime?: number | undefined
451 ): Promise<Entity> {
452 await this._init();
453
454 // "abc/efg" -> "abc/"
455 const parent = getParentFolder(key);
456 const itself = key.slice(0, -1).split("/").pop()!;
457 const { data, error } = await this.client.POST(
458 "/api/v2.1/mounts/{mountId}/files/folder",
459 {
460 params: {
461 query: { path: getKoofrPath(parent, this.remoteBaseDir) },
462 path: { mountId: this.placeID },
463 },
464 body: {
465 name: itself,
466 },
467 }
468 );
469 if (error !== undefined) {
470 throw Error(JSON.stringify(error));
471 }
472 return this.stat(key);
473 }
474
475 async writeFile(
476 key: string,

Callers

nothing calls this directly

Calls 4

_initMethod · 0.95
statMethod · 0.95
getParentFolderFunction · 0.90
getKoofrPathFunction · 0.85

Tested by

no test coverage detected