Solving such a problem in practice depends a bit on the nature of what you're downloading, what you will be doing with it and how soon you need the data.
If this data file is destined to be fed to a specialized program (and not accessed by a user), then a simple security measure would be to encrypt it and then save it to the disk. The program can then decrypt that file when it needs it and the "storage" will not risk accidental contamination. this assumes, however, that the "backend" program cannot be compromised by the data file itself (for instance, through some kind of buffer overflow caused by a crafted data file).
If your threat scope is wider, for instance, if you will perform the download automatically and then allow a user to access the file, then you can store the file in a database or in encrypted form for a few days and then feed it to one or more up-to-date antivirus programs.
Other measures could make some sense - like checking the format of the file early on and rejecting it if it doesn't looks like a data file - but it all depends on what you're doing precisely.