classic-ui/scripts/helpers/save.js
AlienTornadosaurusHex ad0d1391dc static cache should be prefixed by network
Signed-off-by: AlienTornadosaurusHex <>
2023-05-12 22:19:58 +00:00

21 lines
440 B
JavaScript

import fs from 'fs'
import zlib from 'zlib'
export function save(filePath) {
try {
const data = fs.readFileSync(`${filePath}`)
const payload = zlib.deflateSync(data, {
level: zlib.constants.Z_BEST_COMPRESSION,
strategy: zlib.constants.Z_FILTERED
})
fs.writeFileSync(`${filePath}.gz`, payload)
return true
} catch (err) {
console.log('on save error', filePath, err.message)
return false
}
}