somov/yii2-large-file-downloader
Composer 安装命令:
composer require somov/yii2-large-file-downloader
包简介
Download file in multiple streams. With the ability to resume and monitor progress
关键字:
README 文档
README
It is yii2 extension based on yii2-httpclient
Download file in multiple streams. With the ability to resume and monitor progress.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist somov/yii2-large-file-downloader "~1.0"
or add
"somov/yii2-large-file-downloader": "~1.0"
to the require section of your composer.json file.
Usage
/** @var \somov\lfd\Client $client */ $client = Yii::createObject([ 'class' => \somov\lfd\Client::class, //'threadCount' => 5, //'resumeDownload' => true, //'tmpAlias' => '@runtime/downloads' ]); $client->on(\somov\lfd\Client::EVENT_PROGRESS, function ($event){ /** @var \somov\lfd\ProgressEvent $event */ echo $event->percent; }); //Download file $fileName = $client->download("https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4")->data; $size = filesize($fileName); echo $size;
Usage with command controller
Configure the command in your main application configuration:
'controllerMap' => [ 'downloader' => '\somov\lfd\CommandController' ],
Once the extension is installed and configured, simply use it on your command line
yii downloader https://speed.hetzner.de/1GB.bin -c 20
统计信息
- 总下载量: 169
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-04-18