NAME

Mojo::Asset::File - File Asset

SYNOPSIS

    use Mojo::Asset::File;

    my $asset = Mojo::Asset::File->new;
    $asset->add_chunk('foo bar baz');
    print $asset->slurp;

    my $asset = Mojo::Asset::File->new(path => '/foo/bar/baz.txt');
    print $asset->slurp;

DESCRIPTION

Mojo::Asset::File is a container for file assets.

ATTRIBUTES

Mojo::Asset::File implements the following attributes.

cleanup

    my $cleanup = $asset->cleanup;
    $asset      = $asset->cleanup(1);

end_range

    my $end = $asset->end_range;
    $asset  = $asset->end_range(8);

handle

    my $handle = $asset->handle;
    $asset     = $asset->handle(IO::File->new);

path

    my $path = $asset->path;
    $asset   = $asset->path('/foo/bar/baz.txt');

start_range

    my $start = $asset->start_range;
    $asset    = $asset->start_range(0);

tmpdir

    my $tmpdir = $asset->tmpdir;
    $asset     = $asset->tmpdir('/tmp');

METHODS

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

add_chunk

    $asset = $asset->add_chunk('foo bar baz');

contains

    my $position = $asset->contains('bar');

get_chunk

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

move_to

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

size

    my $size = $asset->size;

slurp

    my $string = $file->slurp;

SEE ALSO

Mojolicious, Mojolicious::Book, http://mojolicious.org.