Man pages sections > man3 > Catmandu::FileBag::Index

Catmandu::FileBag::Index - Flag a Bag as a FileStore Index

Catmandu::FileBag::Index(3pm) User Contributed Perl Documentation Catmandu::FileBag::Index(3pm)

NAME

Catmandu::FileBag::Index - Flag a Bag as a FileStore Index

SYNOPSIS

    use Catmandu;
    my $store = Catmandu->store('Simple' , root => 't/data');
    # List all containers
    $store->bag->each(sub {
        my $container = shift;
        print "%s\n" , $container->{_id};
    });
    # Add a new folder
    $store->bag->add({ _id => '1234' });
    # Get the v
    my $files = $store->bag->files('1234');
    # Add a file to the files
    $files->upload(IO::File->new('<foobar.txt'), 'foobar.txt');
    # Stream the contents of a file
    $files->stream(IO::File->new('>foobar.txt'), 'foobar.txt');
    # Delete a file
    $files->delete('foobar.txt');
    # Delete a folder
    $store->bag->delete('1234');

DESCRIPTION

Each Catmandu::FileBag is a Catmandu::Bag and inherits all its methods.

METHODS

files($id)

Return the Catmandu::FileBag for this Catmandu::FileStore containing all the files

SEE ALSO

Catmandu::FileStore , Catmandu::FileBag
2017-10-01 perl v5.26.0