MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / create

Method create

tests/__mocks__/obsidian.ts:55–80  ·  view source on GitHub ↗
(path: string, content: string)

Source from the content-addressed store, hash-verified

53
54 // File operations
55 create(path: string, content: string): MockFile {
56 const normalizedPath = this.normalizePath(path);
57
58 if (this.files.has(normalizedPath)) {
59 throw new Error(`File already exists: ${normalizedPath}`);
60 }
61
62 this.ensureFolderExists(this.getParentPath(normalizedPath));
63
64 const file: MockFile = {
65 path: normalizedPath,
66 name: this.getFileName(normalizedPath),
67 basename: this.getBaseName(normalizedPath),
68 extension: this.getExtension(normalizedPath),
69 content,
70 stat: {
71 ctime: Date.now(),
72 mtime: Date.now(),
73 size: content.length,
74 },
75 };
76
77 this.files.set(normalizedPath, file);
78 this.emitter.emit('create', file);
79 return file;
80 }
81
82 modify(file: MockFile, content: string): void {
83 file.content = content;

Callers

nothing calls this directly

Calls 10

normalizePathMethod · 0.95
ensureFolderExistsMethod · 0.95
getParentPathMethod · 0.95
getFileNameMethod · 0.95
getBaseNameMethod · 0.95
getExtensionMethod · 0.95
hasMethod · 0.80
nowMethod · 0.80
emitMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected