From c243e1f55c94e97ba96eafd5f926e95131819d74 Mon Sep 17 00:00:00 2001 From: cweijan Date: Thu, 21 Sep 2023 15:18:51 +0800 Subject: [PATCH] Fix export to docx fail. --- src/service/markdown/html-export.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/service/markdown/html-export.js b/src/service/markdown/html-export.js index 4f08225..f372581 100644 --- a/src/service/markdown/html-export.js +++ b/src/service/markdown/html-export.js @@ -12,8 +12,9 @@ export async function exportHtml(exportFilePath, data) { export async function exportDocx(exportFilePath, data) { console.log("[pretty-md-pdf] Exported to file: " + exportFilePath) - const exportTask = require("vscode-html-to-docx")(data, '', {}, ''); - fs.writeFileSync(exportFilePath, await exportTask) + const exportTask = await require("vscode-html-to-docx")(data, '', {}, ''); + const buffer = Buffer.from(await exportTask.arrayBuffer()); + fs.writeFileSync(exportFilePath, buffer) } /*