Provided by: libcatmandu-fedoracommons-perl_0.5-2_all
NAME
Catmandu::Store::File::FedoraCommons::Bag - Index of all "files" in a Catmandu::Store::File::FedoraCommons "folder"
SYNOPSIS
use Catmandu; my $store = Catmandu->store('File::FedoraCommons' , baseurl => 'http://localhost:8080/fedora' , username => 'fedoraAdmin' , password => 'fedoraAdmin' , namespace => 'demo' , purge => 1); 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"); # or (faster) $files->upload(IO::File::WithFilename->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");
INHERITED METHODS
This Catmandu::Bag implements: Catmandu::Bag Catmandu::FileBag Catmandu::Droppable perl v5.36.0 2023-02Catmandu::Store::File::FedoraCommons::Bag(3pm)