NAME

Protocol::Tus::LocalDir

SYNOPSIS

# implicit use
use Protocol::Tus;
my $tus = Protocol::Tus->new(
   model => {
      class => 'Protocol::Tus::LocalDir',
      args  => { root => '/path/to/storage' }
   }
);

# explicit usage
use Protocol::Tus;
use Protocol::Tus::LocalDir;

my $model = Protocol::Tus::LocalDir->new(root => '/path/to/storage');
my $tus = Protocol::Tus->new(model => $model);

DESCRIPTION

Model implementation for storing uploads in a local file system.

It

INTERFACE

Protocol::Tus::LocalDir extends base class Protocol::Tus::AbstractModel, implementing all abstract methods and inheriting the other ones.

In addition, the following methods are available:

new

my $tus = Protocol::Tus::LocalDir->new(root => $some_path);

In addition from what inherited from Protocol::Tus::AbstractModel, this class mandates that root is present and points to a directory in the local file system. The directory is supposed to exist.

resolve_path

my $dir_path = $model->resolve_path($id, %opts);

Resolve an identifier to the directory that contains everything about it. The return value is a Path::Tiny object.

root

my $root_dir_path = $model->root;

Get the path to the root of the local storage for uploads. The path is provided as a Path::Tiny object.

update_info

$model->update_info($dir_path, $hash_ref);

Update the info about an upload. The input $dir_path is supposed to be a Path::Tiny object pointing to the upload's directory. The $hash_ref holds key/values that will be added to the current info (possibly overriding previous values).

ANYTHING ELSE (INCLUDING AUTHOR, COPYRIGHT AND LICENSE)

See documentation for Protocol::Tus.