Mediafire::Api - Upload and Download files from mediafire.com file sharing
version 0.01
use Mediafire::Api; # Create Mediafire::Api object my $mediafire = Mediafire::Api->new(); # Login on service $mediafire->login( -login => $login, -password => $password, ); # Upload file to server my $remote_dir = 'myfiles'; # Directory name on server my $filename = '/tmp/test_file.zip'; # Full file path to upload # Upload file on server. Return Mediafire::Api::UploadFile object my $mediafire_file = $mediafire->uploadFile( -file => $filename, -path => $remote_dir, ); # Get uploaded file key print "Uploaded file key: " . $mediafire_file->getDouploadKey() . "\n"; # Find file on mediafire.com by name. Return arrayref to Mediafire::Api::File objects my $find_result = $mediafire->findFileByName( -filename => 'file_to_find.txt', ); if (@$find_result) { print "Found files: " . join(' ', map {$_->name()} @$find_result); } # Download file from mediafire.com $mediafire->downloadFile( -mediafire_file => $mediafire_file, -dest_file => './test_file.zip', );
Set/Get name of file $mediafire_file->name("New name"); my $name = $mediafire->name;
Set/Get download key of file
$mediafire_file->key("downloadfilekey"); my $key = $mediafire_file->key;
Set/Get size of file
$mediafire->size(2343); my $size = $mediafire->size;
Set/Get sha256sum hashsum of file
$mediafire_file->hash('dffdf'); my $hash = $mediafire_file->hash;
Return arrayref with Mediafire::Api::file objects
%opt: -filename => Name of file to find
Download file from mediafire.com to $dest_file
%opt: -mediafire_file => Mediafire::Api::File object to download -dest_file => Name of file on local disk, in which will be downloaded mediafire file
LWP::UserAgent, JSON::XS, URI::Escape, Encode, HTTP::Request, Carp, File::Basename, MIME::Detect, HTTP::Request, Crypt::Digest::SHA256
Pavel Andryushin <vrag867@gmail.com>
This software is copyright (c) 2019 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 Mediafire::Api, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mediafire::Api
CPAN shell
perl -MCPAN -e shell install Mediafire::Api
For more information on module installation, please visit the detailed CPAN module installation guide.