Javascript common functionality across tabix and bai index file processing