reactphp-x / bandwidth
0.0.1
2024-11-14 11:38 UTC
Requires
- react/stream: ^1.4
- reactphp-x/concurrent: ^1.0
- reactphp-x/limiter: ^1.0
- wpjscc/filesystem: ^0.2.0
This package is auto-updated.
Last update: 2024-12-14 11:49:39 UTC
README
install
composer require reactphp-x/bandwidth -vvv
usage
<?php require 'vendor/autoload.php'; use ReactphpX\Bandwidth\Bandwidth; define("BURST_RATE", 1024 * 1024 * 150); // 150KB/sec burst rate define("FILL_RATE", 1024 * 1024 * 50); // 50KB/sec sustained rate $bandwidth = new Bandwidth(BURST_RATE, FILL_RATE); $stream = $bandwidth->file('test.txt'); $stream->on('data', function ($data) { echo $data; }); $stream->on('end', function () { echo "end\n"; });
License
MIT