DownloadDirectoryRequest
extends AbstractTransferRequest
in package
FinalYes
Table of Contents
Constants
- DEFAULT_MAX_CONCURRENCY = 100
Properties
- $configKeys : array<string|int, mixed>
Methods
- __construct() : mixed
- getConfig() : array<string|int, mixed>
- getDestinationDirectory() : string
- getDownloadRequestArgs() : array<string|int, mixed>
- getListeners() : array<string|int, mixed>
- Get current listeners.
- getProgressTracker() : AbstractTransferListener|null
- Get the progress tracker.
- getS3Client() : S3ClientInterface|null
- getSourceBucket() : string
- updateConfigWithDefaults() : void
- validateConfig() : void
- For validating config. By default, it provides an empty implementation.
- validateDestinationDirectory() : void
- Helper method to validate the destination directory exists.
Constants
DEFAULT_MAX_CONCURRENCY
public
mixed
DEFAULT_MAX_CONCURRENCY
= 100
Properties
$configKeys
public
static array<string|int, mixed>
$configKeys
= ['s3_prefix' => 'string', 'filter' => 'callable', 'download_object_request_modifier' => 'callable', 'failure_policy' => 'callable', 'max_concurrency' => 'int', 'track_progress' => 'bool', 'target_part_size_bytes' => 'int', 'list_objects_v2_args' => 'array', 'fails_when_destination_exists' => 'bool']
Methods
__construct()
public
__construct(string $sourceBucket, string $destinationDirectory[, array<string|int, mixed> $downloadRequestArgs = [] ][, array<string|int, mixed> $config = [] ][, array<string|int, AbstractTransferListener> $listeners = [] ][, AbstractTransferListener|null $progressTracker = null ]) : mixed
Parameters
- $sourceBucket : string
-
The bucket from where the files are going to be downloaded from.
- $destinationDirectory : string
-
The destination path where the downloaded files will be placed in.
- $downloadRequestArgs : array<string|int, mixed> = []
- $config : array<string|int, mixed> = []
-
The config options for this download directory operation.
- s3_prefix: (string, optional) This parameter will be considered just if not provided as part of the list_objects_v2_args config option.
- filter: (Closure, optional) A callable which will receive an object key as parameter and should return true or false in order to determine whether the object should be downloaded.
- download_object_request_modifier: (Closure, optional) A function that will be invoked right before the download request is performed and that will receive as parameter the request arguments for each request.
- failure_policy: (Closure, optional) A function that will be invoked
on a download failure and that will receive as parameters:
- $requestArgs: (array) The arguments for the request that originated the failure.
- $downloadDirectoryRequestArgs: (array) The arguments for the download directory request.
- $reason: (Throwable) The exception that originated the request failure.
- $downloadDirectoryResponse: (DownloadDirectoryResult) The download response to that point in the upload process.
- track_progress: (bool, optional) Overrides the config option set in the transfer manager instantiation to decide whether transfer progress should be tracked.
- target_part_size_bytes: (int, optional) The part size in bytes to be used in a range multipart download.
- fails_when_destination_exists: (bool) Whether to fail when a destination file exists.
- max_concurrency: (int, optional) The max number of concurrent downloads.
- list_objects_v2_args: (array, optional) The arguments to be included
as part of the listObjectV2 request in order to fetch the objects to
be downloaded. The most common arguments would be:
- MaxKeys: (int) Sets the maximum number of keys returned in the response.
- Prefix: (string) To limit the response to keys that begin with the specified prefix.
- $listeners : array<string|int, AbstractTransferListener> = []
-
The listeners for watching transfer events. Each listener will be cloned per file upload.
- $progressTracker : AbstractTransferListener|null = null
-
Ideally the progress tracker implementation provided here should be able to track multiple transfers at once. Please see MultiProgressTracker implementation.
getConfig()
public
getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>getDestinationDirectory()
public
getDestinationDirectory() : string
Return values
stringgetDownloadRequestArgs()
public
getDownloadRequestArgs() : array<string|int, mixed>
Return values
array<string|int, mixed>getListeners()
Get current listeners.
public
getListeners() : array<string|int, mixed>
Return values
array<string|int, mixed>getProgressTracker()
Get the progress tracker.
public
getProgressTracker() : AbstractTransferListener|null
Return values
AbstractTransferListener|nullgetS3Client()
public
getS3Client() : S3ClientInterface|null
Return values
S3ClientInterface|nullgetSourceBucket()
public
getSourceBucket() : string
Return values
stringupdateConfigWithDefaults()
public
updateConfigWithDefaults(array<string|int, mixed> $defaultConfig) : void
Parameters
- $defaultConfig : array<string|int, mixed>
validateConfig()
For validating config. By default, it provides an empty implementation.
public
validateConfig() : void
validateDestinationDirectory()
Helper method to validate the destination directory exists.
public
validateDestinationDirectory() : void