mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
feat: use buffers
This commit is contained in:
1 parent
c8bb1f190a
commit
c98c19dc36
26 files changed
+134
-269
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
import { chunk, times, uniq } from 'lodash-es';
|
||||
import { compress, decompress } from 'lz4js';
|
||||
import { commitAssets } from './core/github/commitAssets';
|
||||
import { FileChange } from './core/github/commitMultipleFiles';
|
||||
|
||||
const CHUNK_SIZE = 2 ** 21;
|
||||
const RUN_TIME = 1000 * 60 * 60 * 5.5;
|
||||
@@ -139,24 +140,25 @@ function post() {
|
||||
`Chunk ${index} with ${chunk.length} ids (compressed: ${compressed.length}; uncompressed: ${buffer.length})`,
|
||||
);
|
||||
|
||||
const content = Buffer.from(compressed).toString('base64');
|
||||
const content = Buffer.from(compressed);
|
||||
|
||||
return {
|
||||
content,
|
||||
encoding: 'base64' as const,
|
||||
path: `ids/${index}.dids.lz4`,
|
||||
};
|
||||
} satisfies FileChange;
|
||||
});
|
||||
|
||||
commitAssets('discovered ids', [
|
||||
...files,
|
||||
{
|
||||
content: JSON.stringify({
|
||||
chunks: idsChunked.length,
|
||||
count: ids.length,
|
||||
time: Date.now(),
|
||||
} satisfies DiscoveredIdsDefinitions),
|
||||
encoding: 'utf-8',
|
||||
content: Buffer.from(
|
||||
JSON.stringify({
|
||||
chunks: idsChunked.length,
|
||||
count: ids.length,
|
||||
time: Date.now(),
|
||||
} satisfies DiscoveredIdsDefinitions),
|
||||
'utf-8',
|
||||
),
|
||||
path: 'ids/manifest.json',
|
||||
},
|
||||
]);
|
||||
|
||||
Reference in new issue
Block a user