From 745f4fb59a76b1ba059f277b1b4eeda88a0a1891 Mon Sep 17 00:00:00 2001 From: Piotr Rogowski Date: Mon, 11 Sep 2023 11:30:39 +0200 Subject: [PATCH] Add helper script --- scripts/decompress.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/decompress.js diff --git a/scripts/decompress.js b/scripts/decompress.js new file mode 100644 index 0000000..db96f15 --- /dev/null +++ b/scripts/decompress.js @@ -0,0 +1,18 @@ +const Pako = require('pako'); + +// get file from command line +const file = process.argv[2]; + +// read file +const fs = require('fs'); +const data = fs.readFileSync(file); +const result = Pako.inflate(data, { to: 'string' }); + +// write file with suffix .decompressed +const path = require('path'); +const basename = path.basename(file); +const extname = path.extname(file); +const filename = basename.slice(0, -extname.length); +const newFile = `${filename}.decompressed${extname}`; + +fs.writeFileSync(newFile, result);