Mango::GridFS::Reader(3pm) | User Contributed Perl Documentation | Mango::GridFS::Reader(3pm) |
Mango::GridFS::Reader - GridFS reader
use Mango::GridFS::Reader; my $reader = Mango::GridFS::Reader->new(gridfs => $gridfs);
Mango::GridFS::Reader reads files from GridFS.
Mango::GridFS::Reader implements the following attributes.
my $gridfs = $reader->gridfs; $reader = $reader->gridfs(Mango::GridFS->new);
Mango::GridFS object this reader belongs to.
Mango::GridFS::Reader inherits all methods from Mojo::Base and implements the following new ones.
my $size = $reader->chunk_size;
Chunk size in bytes.
my $type = $reader->content_type;
Content type of file.
my $name = $reader->filename;
Name of file.
my $checksum = $reader->md5;
MD5 checksum for file.
my $data = $reader->metadata;
Additional information.
$reader = $reader->open($oid);
Open file. You can also append a callback to perform operation non-blocking.
$reader->open($oid => sub { my ($reader, $err) = @_; ... }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
my $chunk = $reader->read;
Read chunk. You can also append a callback to perform operation non-blocking.
$reader->read(sub { my ($reader, $err, $chunk) = @_; ... }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
$reader = $reader->seek(13);
Change current position.
my $size = $reader->size;
Size of entire file in bytes.
my $data = $reader->slurp;
Slurp all remaining data from file. You can also append a callback to perform operation non-blocking.
$reader->slurp(sub { my ($reader, $err, $data) = @_; ... }); Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
my $pos = $reader->tell;
Current position.
my $time = $reader->upload_date;
Date file was uploaded.
Mango, Mojolicious::Guides, <http://mojolicio.us>.
2018-04-14 | perl v5.26.1 |