No point in doing this manually: https://github.com/gjtorikian/isBinaryFile