Even though people are not so familiar with classical Indian civilization, they were very highly literate and the extant corpus is enormous. It easily rivals or exceeds classical Greek and Latin. I have heard that the Mahabharata is 10 times longer than the Iliad/Odyssey.
On that line of thought, probably it’s Tibetan and buddhism that must have an extensive library. Most of these works have survived for a very long time.