xz compression

This commit is contained in:
n1073645 2019-11-07 09:20:24 +00:00
parent a8f029309d
commit 77a9481cf9
1 changed files with 16 additions and 1 deletions

View File

@ -1485,7 +1485,7 @@ export const FILE_SIGNATURES = {
4: 0x5a, 4: 0x5a,
5: 0x0 5: 0x0
}, },
extractor: null extractor: extractXZ
}, },
{ {
name: "Tarball", name: "Tarball",
@ -2808,6 +2808,21 @@ export function extractZlib(bytes, offset) {
} }
/**
* XZ extractor
*
* @param {Uint8Array} bytes
* @param {Number} offset
* @returns {string}
*/
export function extractXZ(bytes, offset) {
const stream = new Stream(bytes.slice(offset));
stream.continueUntil([0x00, 0x00, 0x00, 0x00, 0x04, 0x59, 0x5a]);
stream.moveForwardsBy(7);
return stream.carve();
}
/** /**
* ELF extractor. * ELF extractor.
* *