From 6d17427a7c64a17fb1c79e1c2bec3aafa0db8da7 Mon Sep 17 00:00:00 2001 From: Ashraf Teleb Date: Thu, 6 Jan 2022 22:32:51 -0500 Subject: [PATCH] Fixed issue when deployed on windows --- export.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/export.js b/export.js index 2cab9ca..dfc4852 100644 --- a/export.js +++ b/export.js @@ -196,7 +196,8 @@ const withTempDir = async (fn) => { try { return await fn(dir); }finally { - fs.rm(dir, {recursive: true}); + //fs.rm is not available on old node versions + (fs.rm || fs.rmdir)(dir, {recursive: true}); } }; @@ -227,11 +228,15 @@ async function pdfToSvg(pdfFile, xml, transparent) await fs.writeFile(tmpFile + '.pdf', pdfFile); await execFile(process.env.INKSCAPE_PATH || 'inkscape', - [tmpFile + '.pdf', + [ + tmpFile + '.pdf', '--pdf-poppler', '--export-text-to-path', - '--export-plain-svg=' + tmpFile + '.svg']); //TODO --export-plain-svg= is deprecated, cannot find the alternative yet - + '--export-plain-svg', + '--export-filename', + tmpFile + '.svg' + ]); + let svg = await fs.readFile(tmpFile + '.svg', 'utf8'); if (xml)