File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ public function __construct(
60
60
string $ prefix = '' ,
61
61
?VisibilityHandler $ visibilityHandler = null ,
62
62
private string $ defaultVisibility = Visibility::PRIVATE ,
63
- ?MimeTypeDetector $ mimeTypeDetector = null
63
+ ?MimeTypeDetector $ mimeTypeDetector = null ,
64
+ private bool $ streamReads = false ,
64
65
) {
65
66
$ this ->prefixer = new PathPrefixer ($ prefix );
66
67
$ this ->visibilityHandler = $ visibilityHandler ?? new PortableVisibilityHandler ();
@@ -170,9 +171,13 @@ public function read(string $path): string
170
171
public function readStream (string $ path )
171
172
{
172
173
$ prefixedPath = $ this ->prefixer ->prefixPath ($ path );
174
+ $ options = [];
175
+ if ($ this ->streamReads ) {
176
+ $ options ['restOptions ' ]['stream ' ] = true ;
177
+ }
173
178
174
179
try {
175
- $ stream = $ this ->bucket ->object ($ prefixedPath )->downloadAsStream ()->detach ();
180
+ $ stream = $ this ->bucket ->object ($ prefixedPath )->downloadAsStream ($ options )->detach ();
176
181
} catch (Throwable $ exception ) {
177
182
throw UnableToReadFile::fromLocation ($ path , $ exception ->getMessage (), $ exception );
178
183
}
You can’t perform that action at this time.
0 commit comments