public function get_file($filepath, $file = '') {
        list($bucket, $uri) = $this->explode_path($filepath);
        $path = $this->prepare_file($file);
        try {
            $this->s->getObject($bucket, $uri, $path);
        } catch (S3Exception $e) {
            throw new moodle_exception(
                'errorwhilecommunicatingwith',
                'repository',
                '',
                $this->get_name(),
                $e->getMessage()
            );
        }
        return array('path' => $path);
    }