download: add possibility to download to temporally file
This uses standard function mkstemp to generate random file name, anything else is same as in case of download_file. This also changes behaviour of download_file so that it truncates file. It makes much more sense because otherwise we would append data. If we ever need append data then it would make sense to have dedicated option for it.
Showing with 117 additions and 41 deletions