This commit is contained in:
2025-10-09 09:59:38 +02:00
commit 52f50e2060
3 changed files with 63 additions and 0 deletions

27
app.js Normal file
View File

@@ -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!');
});

21
package-lock.json generated Normal file
View File

@@ -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=="
}
}
}

15
package.json Normal file
View File

@@ -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"
}
}