Add the download_attachment_to_file() function

This new function downloads an attachment directly to disk instead of to
memory.  It is useful for two reasons:

* If the user wants to save the attachment to a file anyway, it turns
  several lines of user code into one line.

* If the file is very large, storing the attachment in memory before
  writing it to a file can fill all the available memory in the system.