How? It doesn't have magic powers. This is just stupid. In the history of Trek we have seen countless times people fighting tooth and nail in effort to stop a ship from being destroyed. There are countless ways to break them. And idea that having some data on the hard drive could somehow prevent all of them is just utterly ludicrous.
Except they didn't get just data. It's implied from the outset that the Sphere itself is sentient to some degree. It makes attempts to contact the crew and later actively saves Discovery from getting caught in the explosion when it finally self-destructs. It's also 100,000 years old, there's no telling what it may have learned in order to protect itself from destruction.