def save_as(self, filename):
        """Download the attachment to a file.

        :param filename: File path
        :type filename: basestring
        :raises APIError: When unable to download the data
        :raises OSError: When unable to save the data to disk
        """
        with open(filename, 'w+b') as f:
            for chunk in self._download():
                f.write(chunk)