mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	improvs
This commit is contained in:
		| @@ -22,7 +22,7 @@ const ValidationError = require("../../errors/validation_error"); | ||||
|  * @param {Branch} branch | ||||
|  * @param {string} format - 'html' or 'markdown' | ||||
|  */ | ||||
| function exportToZip(taskContext, branch, format, res, setHeaders = true) { | ||||
| async function exportToZip(taskContext, branch, format, res, setHeaders = true) { | ||||
|     if (!['html', 'markdown'].includes(format)) { | ||||
|         throw new ValidationError(`Only 'html' and 'markdown' allowed as export format, '${format}' given`); | ||||
|     } | ||||
| @@ -478,12 +478,12 @@ ${markdownContent}`; | ||||
|     } | ||||
|  | ||||
|     archive.pipe(res); | ||||
|     archive.finalize(); | ||||
|     await archive.finalize(); | ||||
|  | ||||
|     taskContext.taskSucceeded(); | ||||
| } | ||||
|  | ||||
| function exportToZipFile(noteId, format, zipFilePath) { | ||||
| async function exportToZipFile(noteId, format, zipFilePath) { | ||||
|     const fileOutputStream = fs.createWriteStream(zipFilePath); | ||||
|     const taskContext = new TaskContext('no-progress-reporting'); | ||||
|  | ||||
| @@ -493,7 +493,9 @@ function exportToZipFile(noteId, format, zipFilePath) { | ||||
|         throw new ValidationError(`Note ${noteId} not found.`); | ||||
|     } | ||||
|  | ||||
|     exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false); | ||||
|     await exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false); | ||||
|  | ||||
|     log.info(`Exported '${noteId}' with format '${format}' to '${zipFilePath}'`); | ||||
| } | ||||
|  | ||||
| module.exports = { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user