node-liblzma - v3.1.2
    Preparing search index...

    Function isXZ

    • Check if a buffer contains XZ compressed data by examining magic bytes.

      Parameters

      • buffer: Buffer

        Buffer to check (needs at least 6 bytes)

      Returns boolean

      true if the buffer starts with XZ magic bytes

      const compressed = await xzAsync(Buffer.from('Hello'));
      console.log(isXZ(compressed)); // true
      console.log(isXZ(Buffer.from('Hello'))); // false