MCPcopy Create free account
hub / github.com/CatMuse/HiNote / createMarkdownFile

Method createMarkdownFile

src/services/export/ExportFileWriter.ts:7–19  ·  view source on GitHub ↗
(fileName: string, content: string, exportPath: string)

Source from the content-addressed store, hash-verified

5 constructor(private app: App) {}
6
7 async createMarkdownFile(fileName: string, content: string, exportPath: string): Promise<TFile> {
8 const fullPath = await this.getExportPath(fileName, exportPath);
9
10 try {
11 return await this.app.vault.create(`${fullPath}.md`, content);
12 } catch (error) {
13 if (error.message && error.message.includes("already exists")) {
14 throw new Error(t("Export file already exists. Please try again in a moment."));
15 }
16
17 throw new Error(t("Failed to create export file: ") + error.message);
18 }
19 }
20
21 private async getExportPath(fileName: string, exportPath: string): Promise<string> {
22 if (!exportPath) {

Callers 1

createExportFileMethod · 0.80

Calls 3

getExportPathMethod · 0.95
tFunction · 0.90
createMethod · 0.65

Tested by

no test coverage detected