NAME

Mojo::File::Memory - In-Memory File

SYNOPSIS

use Mojo::File::Memory;

my $file = Mojo::File::Memory->new;
$file->add_chunk('World!');
print $file->slurp;

DESCRIPTION

Mojo::File::Memory is a container for in-memory files.

ATTRIBUTES

Mojo::File::Memory inherits all attributes from Mojo::File and implements the following new ones.

content

my $handle = $file->content;
$file      = $file->content('Hello World!');

METHODS

Mojo::File::Memory inherits all methods from Mojo::File and implements the following new ones.

add_chunk

$file = $file->add_chunk('test 123');

contains

my $position = $file->contains('random string');

copy_to

$file = $file->copy_to('/foo/bar/baz.txt');

get_chunk

my $chunk = $file->get_chunk($offset);

length

my $length = $file->length;

move_to

$file = $file->move_to('/foo/bar/baz.txt');

slurp

my $string = $file->slurp;