Check if an image is valid PNG file

Viewed 3700

I am having troubles with downloading images in binary format, sometimes a downloaded file is corrupted image.

So I need to check whether downloaded file is a valid PNG image.

I have already tried this library Is-png, but it reads only first 8 bytes of the file and doesn't consider a whole file.

So I need to find a library that could check whether a whole file is valid png image or not.

Please suggest the best way to achieve this, maybe there are some great tools already exist.

Thanks

1 Answers
Related