mirror of
https://github.com/zoriya/flood.git
synced 2026-06-04 19:36:42 +00:00
build: embed mmdb as pure js data (#782)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import * as zlib from 'node:zlib';
|
||||
import * as fs from 'node:fs';
|
||||
|
||||
const buf = fs.readFileSync('server/geoip/GeoLite2-Country.mmdb');
|
||||
|
||||
const compressed = zlib.brotliCompressSync(buf).toString('base64');
|
||||
|
||||
fs.writeFileSync(
|
||||
'server/geoip/data.ts',
|
||||
`
|
||||
import * as zlib from 'node:zlib';
|
||||
|
||||
// data is brotli compressed GeoLite2-Country.mmdb in base64 format
|
||||
export const data = zlib.brotliDecompressSync(Buffer.from('${compressed}', 'base64'));
|
||||
`,
|
||||
);
|
||||
Reference in New Issue
Block a user