How to check if a Unix .tar.gz file is a valid file without uncompressing?

后端 未结 8 1589

I have found the question How to determine if data is valid tar file without a file?, but I was wondering: is there a ready made command line solution?

8条回答
  •  生来不讨喜
    2020-11-30 20:51

    These are all very sub-optimal solutions. From the GZIP spec

    ID2 (IDentification 2)
    These have the fixed values ID1 = 31 (0x1f, \037), ID2 = 139 (0x8b, \213), to identify the file as being in gzip format.

    Has to be coded into whatever language you're using.

提交回复
热议问题