Yandex::Disk - a simple API for Yandex Disk
Return disk info data as hashref
$disk->getDiskInfo(); Example output: { max_file_size 1073741824, revision 14987326771107, system_folders { applications "disk:/Приложения", downloads "disk:/Загрузки/", facebook "disk:/Социальные сети/Facebook", google "disk:/Социальные сети/Google+", instagram "disk:/Социальные сети/Instagram", mailru "disk:/Социальные сети/Мой Мир", odnoklassniki "disk:/Социальные сети/Одноклассники", photostream "disk:/Фотокамера/", screenshots "disk:/Скриншоты/", social "disk:/Социальные сети/", vkontakte "disk:/Социальные сети/ВКонтакте" }, total_space 67645734912, trash_size 0, used_space 19942927435, user { login "login", uid 123456 } }
Upload file (-file) to Yandex Disk in folder (-remote_path). Return 1 if success
$disk->uploadFile(-file => '/root/upload', -remote_path => 'Temp', -overwrite => 0); Options: -overwrite => Owervrite file if exists (default: 1) -remote_path => Path to upload file on disk -file => Path to local file
Create folder on disk
$disk->createFolder(-path => 'Temp/test', -recursive => 1); Options: -path => Path to folder, -recursive => Recursive create folder (default: 0)
Delete file or folder from disk. Return 1 if success
$disk->deleteResource(-path => 'Temp/test'); Options: -path => Path to delete file or folder -permanently => Do not move to trash, delete permanently (default: 0) -wait => Wait delete resource (defailt: 0)
Download file from Yandex Disk to local file. Method overwrites local file if exists. Return 1 if success
$disk->downloadFile(-path => 'Temp/test', -file => 'test'); Options: -path => Path to file on Yandex Disk -file => Path to local destination
Empty trash. If -path specified, delete -path resource, otherwise - empty all trash. Return 1 if success
$disk->emptyTrash(-path => 'Temp/test'); #Delete '/Temp/test' from trash Options: -path => Path to resource on Yandex Disk to delete from trash -wait => Wait empty trash (defailt: 0) $disk->emptyTrash; #Full empty trash
List files in folder. Return arrayref to hashref(keys: "path", "type", "name", "preview", "created", "modified", "md5", "mime_type", "size")
$disk->listFiles(-path => 'Temp/test'); Options: -path => Path to resource (file or folder) on Yandex Disk for which need get info -limit => Limit max files to output (default: unlimited) -offset => Offset records from start (default: 0)
my $public = $disk->public(); #Create Yandex::Disk::Public object
LWP::UserAgent, JSON::XS, URI::Escape, IO::Socket::SSL
Pavel Andryushin <vrag867@gmail.com>
This software is copyright (c) 2017 by Pavel Andryushin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Yandex::Disk, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Yandex::Disk
CPAN shell
perl -MCPAN -e shell install Yandex::Disk
For more information on module installation, please visit the detailed CPAN module installation guide.