mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-09-21 13:31:42 +00:00
feat(worker): 7z signature-header parser
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
const SEVENZ_MAGIC = Buffer.from([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c]);
|
||||
|
||||
export function parseSevenZSignatureHeader(
|
||||
buf: Buffer,
|
||||
): { nextHeaderOffset: number; nextHeaderSize: number } | null {
|
||||
if (buf.length < 32) return null;
|
||||
if (!buf.subarray(0, 6).equals(SEVENZ_MAGIC)) return null;
|
||||
return {
|
||||
nextHeaderOffset: Number(buf.readBigUInt64LE(12)),
|
||||
nextHeaderSize: Number(buf.readBigUInt64LE(20)),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user