Name
SPVM::Mojo::Asset - HTTP content storage base class
Description
Mojo::Asset class in SPVM an abstract base class for HTTP content storage backends, like Mojo::Asset::File and Mojo::Asset::Memory.
Usage
use Mojo::Asset;
class Mojo::Asset::MyAsset extends Mojo::Asset {
}
Fields
end_range
has end_range : rw long;
Pretend file ends earlier.
start_range
has start_range : rw long;
Pretend file starts later.
Instance Methods
add_chunk
method add_chunk : Mojo::Asset ($chunk : string);
Add chunk of data to asset. Meant to be overloaded in a subclass.
contains
method contains : int ($string : string);
Check if asset contains a specific string. Meant to be overloaded in a subclass.
get_chunk
method get_chunk : string ($offset : long, $max : int = -1);
Get chunk of data starting from a specific position, defaults to a maximum chunk size of 131072
bytes (128KiB). Meant to be overloaded in a subclass.
is_file
method is_file : int ();
False, this is not a Mojo::Asset::File object.
is_range
method is_range : int ();
Check if asset has a "start_range" or "end_range".
move_to
method move_to : void ($file : string);
Move asset data into a specific file. Meant to be overloaded in a subclass.
mtime
method mtime : long ();
Modification time of asset. Meant to be overloaded in a subclass.
set_mtime
method set_mtime : void ($mtime : long);
Set modification time of asset. Meant to be overloaded in a subclass.
size
method size : long ();
Size of asset data in bytes. Meant to be overloaded in a subclass.
slurp
method slurp : string ();
Read all asset data at once. Meant to be overloaded in a subclass.
to_file
method to_file : Mojo::Asset::File ();
Convert asset to Mojo::Asset::File object. Meant to be overloaded in a subclass.
Well Known Child Classes
See Also
Copyright & License
Copyright (c) 2025 Yuki Kimoto
MIT License