• Determines whether a file is gzip-compressed by inspecting its magic bytes.

    Reads the first two bytes of the file and checks for the gzip signature (0x1f, 0x8b). This avoids relying on file extensions and allows safe conditional decompression in stream pipelines.

    Parameters

    • path: string

      Absolute or relative file path to test.

    Returns boolean

    true if the file appears to be gzip-compressed; otherwise false.