You've already forked symfony-storage
stream opening
This commit is contained in:
@@ -128,6 +128,20 @@ class S3Storage implements StorageAdaptor
|
|||||||
fclose($file_stream);
|
fclose($file_stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ouvre le stream d'un fichier stocké dans S3
|
||||||
|
* @param $distant_path
|
||||||
|
* @param $target_stream
|
||||||
|
*/
|
||||||
|
public function getStream ($distant_path)
|
||||||
|
{
|
||||||
|
return $this->client->getObject([
|
||||||
|
'Bucket' => $this->bucket,
|
||||||
|
'Key' => $this->getPrefix().$distant_path,
|
||||||
|
'Path' => $this->getPrefix().$distant_path,
|
||||||
|
])->get('Body')->detach();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Permet de stream un fichier stocké dans S3
|
* Permet de stream un fichier stocké dans S3
|
||||||
* @param $distant_path
|
* @param $distant_path
|
||||||
@@ -135,13 +149,7 @@ class S3Storage implements StorageAdaptor
|
|||||||
*/
|
*/
|
||||||
public function stream ($distant_path, $target_stream)
|
public function stream ($distant_path, $target_stream)
|
||||||
{
|
{
|
||||||
$aws_stream = $this->client->getObject([
|
stream_copy_to_stream($this->getStream($distant_path), $target_stream);
|
||||||
'Bucket' => $this->bucket,
|
|
||||||
'Key' => $this->getPrefix().$distant_path,
|
|
||||||
'Path' => $this->getPrefix().$distant_path,
|
|
||||||
])->get('Body')->detach();
|
|
||||||
|
|
||||||
stream_copy_to_stream($aws_stream, $target_stream);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user