diff --git a/app/controllers/Export.controller.js b/app/controllers/Export.controller.js index a96fb41..28b369e 100644 --- a/app/controllers/Export.controller.js +++ b/app/controllers/Export.controller.js @@ -41,7 +41,17 @@ class Export extends Controller { await fs.mkdir(temp_dir) this._markdown_recurse(page0, temp_dir) - return res.api({ temp_dir }) + + const exec = require('child_process').exec; + exec('zip -r ' + path.resolve(temp_dir, 'archive.zip') + ' ' + path.resolve(temp_dir), (error) => { + if (error) { + console.error(`exec error: ${error}`); + return res.error(500); + return; + } + + return res.sendFile(`${path.resolve(temp_dir, 'archive.zip')}`) + }) } async _markdown_recurse(root, temp_dir) { //recursive function for creating directory and generating markdown pages