8000 webui : use fflate for more deterministic gzip compress (#13525) · ggml-org/llama.cpp@bb1681f · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb1681f

Browse files
authored
webui : use fflate for more deterministic gzip compress (#13525)
* webui : use pako for more deterministic gzip compress * simpler code * use fflate instead of pako
1 parent d486dd3 commit bb1681f

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

tools/server/public/index.html.gz

49.4 KB
Binary file not shown.

tools/server/webui/package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/server/webui/package.json

Lines changed: 1 addition & 0 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"eslint": "^9.17.0",
4848
"eslint-plugin-react-hooks": "^5.0.0",
4949
"eslint-plugin-react-refresh": "^0.4.16",
50+
"fflate": "^0.8.2",
5051
"globals": "^15.14.0",
5152
"prettier": "^3.4.2",
5253
"sass-embedded": "^1.83.4",

tools/server/webui/vite.config.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import react from '@vitejs/plugin-react';
33
import { viteSingleFile } from 'vite-plugin-singlefile';
44
import path from 'node:path';
55
import fs from 'node:fs';
6-
import zlib from 'node:zlib';
6+
import * as fflate from 'fflate';
77

88
/* eslint-disable */
99

@@ -33,9 +33,10 @@ const BUILD_PLUGINS = [
3333
},
3434
writeBundle() {
3535
const outputIndexHtml = path.join(config.build.outDir, 'index.html');
36-
const content =
36+
let content =
3737
GUIDE_FOR_FRONTEND + '\n' + fs.readFileSync(outputIndexHtml, 'utf-8');
38-
const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'), {
38+
content = content.replace(/\r/g, ''); // remove windows-style line endings
39+
const compressed = fflate.gzipSync(Buffer.from(content, 'utf-8'), {
3940
level: 9,
4041
});
4142

0 commit comments

Comments
 (0)
0