Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -7,7 +7,7 @@ export type ZipEntryInput = {
|
||||
|
||||
type NormalizedZipEntry = {
|
||||
path: string;
|
||||
data: Uint8Array;
|
||||
data: Buffer;
|
||||
crc32: number;
|
||||
modifiedAt: Date;
|
||||
};
|
||||
@@ -38,7 +38,7 @@ export function createStoredZipBuffer(entries: readonly ZipEntryInput[]): Buffer
|
||||
for (const entry of normalized) {
|
||||
const fileName = Buffer.from(entry.path, "utf8");
|
||||
const localHeader = buildLocalFileHeader(entry, fileName);
|
||||
localParts.push(localHeader, Buffer.from(entry.data));
|
||||
localParts.push(localHeader, entry.data);
|
||||
centralParts.push(buildCentralDirectoryHeader(entry, fileName, offset));
|
||||
offset += localHeader.byteLength + entry.data.byteLength;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export function createStoredZipBuffer(entries: readonly ZipEntryInput[]): Buffer
|
||||
|
||||
function normalizeEntry(entry: ZipEntryInput): NormalizedZipEntry {
|
||||
const path = normalizeZipPath(entry.path);
|
||||
const data = typeof entry.data === "string" ? new TextEncoder().encode(entry.data) : entry.data;
|
||||
const data = typeof entry.data === "string" ? Buffer.from(entry.data, "utf8") : Buffer.isBuffer(entry.data) ? entry.data : Buffer.from(entry.data);
|
||||
return {
|
||||
path,
|
||||
data,
|
||||
@@ -135,8 +135,8 @@ function toDosDateTime(date: Date): { dosTime: number; dosDate: number } {
|
||||
|
||||
function crc32(data: Uint8Array): number {
|
||||
let crc = 0xffffffff;
|
||||
for (const byte of data) {
|
||||
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ byte) & 0xff];
|
||||
for (let index = 0; index < data.byteLength; index += 1) {
|
||||
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ data[index]!) & 0xff]!;
|
||||
}
|
||||
return (crc ^ 0xffffffff) >>> 0;
|
||||
}
|
||||
@@ -148,5 +148,5 @@ const CRC32_TABLE = new Uint32Array(
|
||||
value = value & 1 ? 0xedb88320 ^ (value >>> 1) : value >>> 1;
|
||||
}
|
||||
return value >>> 0;
|
||||
}),
|
||||
})
|
||||
);
|
||||
Reference in new issue
Block a user