Catman...ti::Bag(3pm)
π Catmandu::Store::File::Multi::Bag π
okay bestie, so this is the manual page for Catmandu::Store::File::Multi::Bag, straight out of the User Contributed Perl Documentation, section 3pm. It's a whole vibe and honestly it's giving "I hold your entire filesystem together." π
β¨ NAME β¨
Catmandu::Store::File::Multi::Bag β it's the index of all the "files" chillin' inside a Catmandu::Store::File::Multi "folder". Like, every file, indexed, accounted for, no strays. π¦
πΈ SYNOPSIS πΈ
use Catmandu;
my $store = Catmandu->store('File::Multi' , stores [
Catmandu->store('File::Simple', root => '/data1/files') ,
Catmandu->store('File::Simple', root => '/data1/files_copy') ,
]);
my $index = $store->index;
# List all containers
$index->each(sub {
my $container = shift;
print "%s\n" , $container->{_id};
});
# Add a new folder
$index->add({_id => '1234'});
# Delete a folder
$index->delete(1234);
# Get a folder
my $folder = $index->get(1234);
# Get the files in an folder
my $files = $index->files(1234);
$files->each(sub {
my $file = shift;
my $name = $file->{_id};
my $size = $file->{size};
my $content_type = $file->{content_type};
my $created = $file->{created};
my $modified = $file->{modified};
$file->stream(IO::File->new(">/tmp/$name"), file);
});
# Add a file
$files->upload(IO::File->new("<data.dat"),"data.dat");
# Retrieve a file
my $file = $files->get("data.dat");
# Stream a file to an IO::Handle
$files->stream(IO::File->new(">data.dat"),$file);
# Delete a file
$files->delete("data.dat");
# Delete a folders
$index->delete("1234");
okay so literally everything you'd ever wanna do to a folder is right there β list it, add it, delete it, grab it, and then dive into the files inside it, upload, retrieve, stream, delete. the whole pipeline, slay. π
π INHERITED METHODS π
This Catmandu::Bag implements all of these, no cap:
Catmandu::BagCatmandu::FileBagCatmandu::Droppable
so it's got bag energy, file-bag energy, and droppable energy all stacked on top of each other. main character inheritance fr fr. π«Ά
that's the whole page, bestie β nothing left out, everything kept, periodt. π
sign-off cuteness: this page came from perl v5.36.0, dated 2022-12-10. go forth and index your files, queen. β¨ππ
π¦ where this page comes from
- debian bookworm: libcatmandu-filestore-perl 1.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-filestore-perl 1.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms