use fopen directly when reading objects from s3

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-10-26 17:05:09 +02:00 committed by Bjoern Schiessle
parent e873b1a3d1
commit 1ed9a25ae8
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 8 additions and 5 deletions

View File

@ -49,12 +49,15 @@ trait S3ObjectTrait {
'Bucket' => $this->bucket,
'Key' => $urn
]);
$command['@http']['stream'] = true;
$result = $client->execute($command);
/** @var StreamInterface $body */
$body = $result['Body'];
$request = \Aws\serialize($command);
$opts = [
'http' => [
'header' => $request->getHeaders()
]
];
return $body->detach();
$context = stream_context_create($opts);
return fopen($request->getUri(), 'r', false, $context);
}
/**