public function download($link)
    {
        $file = $this->getFile($link);

        $relPath = $this->getItemDirectory()->getRelPath($file);

        $tmpDir = rtrim(\tao_helpers_File::createTempDir(), '/');
        $tmpFile = $tmpDir . $relPath;
        if (! is_dir(dirname($tmpFile))) {
            mkdir(dirname($tmpFile), 0755, true);
        }

        if (($resource = fopen($tmpFile, 'w')) !== false) {
            stream_copy_to_stream($file->readStream(), $resource);
            fclose($resource);
            return $tmpFile;
        }

        throw new \common_Exception('Unable to write "' . $link . '" into tmp folder("' . $tmpFile . '").');
    }