Parse the index from a complete XZ file buffer to get metadata. This allows you to know the uncompressed size before decompressing.
Complete XZ file buffer
Object with file metadata
Error if buffer is not a valid XZ stream
const compressed = await xzAsync(largeBuffer);const info = parseFileIndex(compressed);console.log(`Uncompressed: ${info.uncompressedSize}, Compressed: ${info.compressedSize}`);console.log(`Ratio: ${(info.compressedSize / info.uncompressedSize * 100).toFixed(1)}%`); Copy
const compressed = await xzAsync(largeBuffer);const info = parseFileIndex(compressed);console.log(`Uncompressed: ${info.uncompressedSize}, Compressed: ${info.compressedSize}`);console.log(`Ratio: ${(info.compressedSize / info.uncompressedSize * 100).toFixed(1)}%`);
Parse the index from a complete XZ file buffer to get metadata. This allows you to know the uncompressed size before decompressing.