Mango:...:Reader(3pm)

πŸ“¦
version 1.30 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Mango::GridFS::Reader β€” the GridFS reader bestie πŸ’–

okay so welcome to Mango::GridFS::Reader, a page from the User Contributed Perl Documentation, filed under Mango:...:Reader(3pm). she reads files. from GridFS. that's the whole vibe and honestly? iconic.


✨ NAME ✨

Mango::GridFS::Reader β€” GridFS reader πŸ¦‹


✨ SYNOPSIS ✨

use Mango::GridFS::Reader;

my $reader = Mango::GridFS::Reader->new(gridfs => $gridfs);

like. that's it. that's the whole summoning ritual. no cap. πŸ’…


✨ DESCRIPTION ✨

Mango::GridFS::Reader reads files from GridFS. that's the assignment, and she ate. πŸ”₯


✨ ATTRIBUTES ✨

Mango::GridFS::Reader implements the following attributes. yes bestie, we're doing all of them, no skipping. πŸŽ€

✨ gridfs ✨

my $gridfs = $reader->gridfs;
$reader    = $reader->gridfs(Mango::GridFS->new);

the Mango::GridFS object this reader belongs to. it's giving main character's origin story. 🌸


✨ METHODS ✨

Mango::GridFS::Reader inherits all methods from Mojo::Base and implements the following new ones. (so everything Mojo::Base gave her? still there. we don't disown family. 🫢)

✨ chunk_size ✨

my $size = $reader->chunk_size;

chunk size, in bytes. πŸ“

✨ content_type ✨

my $type = $reader->content_type;

content type of file. slay. πŸ’…

✨ filename ✨

my $name = $reader->filename;

name of file. yes she knows her own name, she's not having an identity crisis. πŸͺž

✨ md5 ✨

my $checksum = $reader->md5;

MD5 checksum for file. the fingerprint. the receipts. 🧾

✨ metadata ✨

my $data = $reader->metadata;

additional information. the lore. πŸ“–

✨ open ✨

$reader = $reader->open($oid);

open file. and bestie β€” you can also append a callback to perform the operation non-blocking. multitasking queen behavior. πŸ‘‘

$reader->open($oid => sub {
  my ($reader, $err) = @_;
  ...
});
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

✨ read ✨

my $chunk = $reader->read;

read chunk. yep, you can also append a callback here to perform the operation non-blocking. same energy, different method. πŸ”₯

$reader->read(sub {
  my ($reader, $err, $chunk) = @_;
  ...
});
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

✨ seek ✨

$reader = $reader->seek(13);

change current position. glow-up, but for your file pointer. ✨

✨ size ✨

my $size = $reader->size;

size of entire file, in bytes. the full scope. the whole picture. πŸ“

✨ slurp ✨

my $data = $reader->slurp;

slurp all remaining data from file. all of it. no crumbs left. 😭 and yes, you can also append a callback to perform the operation non-blocking. πŸ’–

$reader->slurp(sub {
  my ($reader, $err, $data) = @_;
  ...
});
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

✨ tell ✨

my $pos = $reader->tell;

current position. where are we? she'll tell you. πŸ“

✨ upload_date ✨

my $time = $reader->upload_date;

date file was uploaded. the anniversary. the throwback. πŸ—“οΈ


✨ SEE ALSO ✨

Mango, Mojolicious::Guides, <http://mojolicio.us>. go read those too, bestie, they're the supporting cast. 🌈


and that's the page!! πŸ’œ this whole thing comes from perl v5.30.3, dated 2020-06-05, and it lives in the User Contributed Perl Documentation section as Mango:...:Reader(3pm). mwah. periodt. πŸ’…πŸŽ€βœ¨