NAME
Catmandu::Store::File::Memory - A Catmandu::FileStore to keep files in memory
SYNOPSIS
# From Perl
use Catmandu;
my $store = Catmandu->store('File::Mempory');
my $index = $store->index;
# List all folders
$index->each(sub {
my $container = shift;
print "%s\n" , $container->{_id};
});
# Add a new folder
$index->add({ _id => '1234' });
# Get the folder
my $files = $index->files('1234');
# Add a file to the folder
$files->upload(IO::File->new('<foobar.txt'), 'foobar.txt');
# Retrieve a file
my $file = $files->get('foobar.txt');
# Stream the contents of a file
$files->stream(IO::File->new('>foobar.txt'), $file);
# Delete a file
$files->delete('foobar.txt');
# Delete a container
$index->delete('1234');
INHERITED METHODS
This Catmandu::FileStore implements:
The index Catmandu::Bag in this Catmandu::Store implements:
The file Catmandu::Bag in this Catmandu::Store implements:
SEE ALSO
Catmandu::Store::File::Memory::Index, Catmandu::Store::File::Memory::Bag, Catmandu::Plugin::SideCar, Catmandu::FileStore