src/BaiduBce/Services/Bos/BosClient.php
public function getObjectToFile(
        $bucketName,
        $key,
        $filename,
        $options = array()
    )
    {
        $outputStream = fopen($filename, 'w+');
        try {
            $response = $this->getObject(
                $bucketName,
                $key,
                $outputStream,
                $options
            );
            if(is_resource($outputStream)) {
                fclose($outputStream);
            }
            return $response;
        } catch (\Exception $e) {
            if(is_resource($outputStream)) {
                fclose($outputStream);
            }
            throw $e;
        }
    }
public function getObjectToFile(
        $bucketName,
        $key,
        $filename,
        $options = array()
    )
    {
        $outputStream = fopen($filename, 'w+');
        try {
            $response = $this->getObject(
                $bucketName,
                $key,
                $outputStream,
                $options
            );
            if(is_resource($outputStream)) {
                fclose($outputStream);
            }
            return $response;
        } catch (\Exception $e) {
            if(is_resource($outputStream)) {
                fclose($outputStream);
            }
            throw $e;
        }
    }
public function getObjectToFile ( $ bucketName , $ key , $ filename , $ options = array ( ) ) { $ outputStream = fopen ( $ filename , 'w+' ) ; try { $ response = $ this -> getObject ( $ bucketName , $ key , $ outputStream , $ options ) ; if ( is_resource ( $ outputStream ) ) { fclose ( $ outputStream ) ; } return $ response ; } catch ( \ Exception $ e ) { if ( is_resource ( $ outputStream ) ) { fclose ( $ outputStream ) ; } throw $ e ; } }
Get Content of Object and Put Content to File

@param string $bucketName The bucket name.
@param string $key The object path.
@param string $filename The destination file name.
@param string $range The HTTP 'Range' header.
@param mixed $options The optional bce configuration, which will overwrite the
default configuration that was passed while creating BosClient instance.

@return mixed
Get Content of Object and Put Content to File