classic-ui/scripts/helpers/save.js

18 lines
326 B
JavaScript
Raw Normal View History

import fs from 'fs'
import zipper from 'zip-local'
export function save(fileName) {
try {
zipper.sync
.zip(`${fileName}`)
.compress()
.save(`${fileName}.zip`)
fs.unlinkSync(fileName)
return true
} catch (err) {
console.log('on save error', fileName, err.message)
return false
}
}