How to check File is .tar using Magento 2?

Verify Filename has extension .tar or not using PHP Magento 2.

If the file is a valid tar file, the result will be true otherwise result will be false. Some time you need to verify the current file is tar or not in that scenario, this article is used for your development.

If filename is, The result will be false due to .zip is not valid tar.
If filename is data.tar, its valid tar file and result will be true.

Call method, $this->verifyTar() and pass valid tar file as filename.

Output: Boolean
If Valid Tar file, true otherwise result will be false.