Star Trek mostly avoided that problem. They made up a fictional unit of data storage called a "quad" to avoid the problem of "the Borg source code is too big for our databanks, it's 3.2 gigabytes in size."
The author of the novelization of Wrath of Kahn didn't see it coming; one of the scientists on Regula 1 in the book, not the movie, complains that his personal computer didn't have enough room for a 4 megabyte "50 meg" game.