mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-29 18:21:57 +08:00
17 lines
573 B
JavaScript
17 lines
573 B
JavaScript
const path = require("path");
|
|
const { createReadStream, createWriteStream } = require("fs");
|
|
const { createGzip } = require("zlib");
|
|
const faviconPath = path.normalize(__dirname + "/../assets/favicon.ico");
|
|
|
|
// Create a gzip function for reusable purpose
|
|
const compressFile = (filePath) => {
|
|
const stream = createReadStream(filePath);
|
|
stream
|
|
.pipe(createGzip())
|
|
.pipe(createWriteStream(`${filePath}.gz`))
|
|
.on("finish", () =>
|
|
console.log(`Successfully compressed the file at ${filePath}`)
|
|
);
|
|
};
|
|
compressFile(faviconPath);
|