commit 52f50e20603bb392b3d4c1fe7d4c080300bd90bc Author: pgaca Date: Thu Oct 9 09:59:38 2025 +0200 kod gzip diff --git a/app.js b/app.js new file mode 100644 index 0000000..153d298 --- /dev/null +++ b/app.js @@ -0,0 +1,27 @@ +// const {gzip, ungzip} = require('node-gzip'); +// const fs = require('fs') +// const file = fs.readFileSync('./place_order_form.js','utf-8') +// console.log(file) +// gzip(file) +// .then((compressed) => { +// return gzip(compressed); +// }) +// .then((decompressed) => { + +// fs.writeFileSync('./place_order_form.js.gzip',decompressed) +// console.log(decompressed) + +// console.log(decompressed.toString()); //Hello World +// }); + +const fs = require('fs'); +const zlib = require('zlib'); + +const input = fs.createReadStream('style.css'); // Replace 'yourfile.js' with the name of your JS file +const output = fs.createWriteStream('style.css.gzip'); // The output will be 'yourfile.js.gz' + +input.pipe(zlib.createGzip()).pipe(output); + +output.on('finish', () => { + console.log('File successfully gzipped!'); +}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1756528 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "gzip", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "gzip", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "node-gzip": "^1.1.2" + } + }, + "node_modules/node-gzip": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/node-gzip/-/node-gzip-1.1.2.tgz", + "integrity": "sha512-ZB6zWpfZHGtxZnPMrJSKHVPrRjURoUzaDbLFj3VO70mpLTW5np96vXyHwft4Id0o+PYIzgDkBUjIzaNHhQ8srw==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..3c3a709 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "gzip", + "version": "1.0.0", + "description": "", + "main": "app.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "node-gzip": "^1.1.2" + } +}