flysystem
flysystem copied to clipboard
Limit S3 bandwidth
Hello,
I'm using this version of your library: https://github.com/thephpleague/flysystem-aws-s3-v3/tree/3.x
I need to limit the bandwidth to 500 Mbps so as not to saturate my connection when uploading very large files. I haven't found any documentation on the subject, is there a parameter to do this?
Thanks
I found this parameter for AWS SDK : https://docs.aws.amazon.com/cli/latest/topic/s3-config.html#max-bandwidth
But I don't know how to use it via Flysystem
Bandwidth limiting is part of the CLI, not of the S3 API as far as I can tell.
Assuming you're uploading files via writeStream it should be possible to implement a RateLimitingAdapter decorator.
Do you know how to do that ?
I do not at this moment. It's solvable via PHP stream wrappers, but you'll have to do the research yourself.
To create a RateLimitingAdapteror LimitUploadBandwithAdapter wrapper, you could extend DecoratedAdapter and just override write() and writeStream() with functions that create a new stream (extend StreamInterface) with a built-in periodical 'delay'.