NAME
Mojo::Tar::File - A Mojo::Tar file
SYNOPSIS
my $file = Mojo::Tar->new(path => 'some/file.txt');
# This can be dangerous! Make sure path() does not contain ".."
# or other dangerous path parts.
$file->asset->move_to($file->path);
DESCRIPTION
Mojo::Asset::File represents a tar file.
ATTRIBUTES
asset
$file = $file->asset(Mojo::File->new);
$asset = $file->asset;
Returns a Mojo::File object. Defaults to "tempfile" in Mojo::File.
This attribute is currently EXPERIMENTAL, but unlikely to change.
checksum
$str = $file->checksum;
Holds the checksum read by "from_header" or contains empty string if the checksum does not match. This attribute can also be built from all the attributes if "from_header" was not called.
dev_major
This attribute is not supported yet. Pull request welcome!
dev_minor
This attribute is not supported yet. Pull request welcome!
gid
$file = $file->gid(1001);
$int = $file->gid;
The numeric representation of "group".
group
$file = $file->group('users')
$str = $file->group;
The string representation of "gid".
is_complete
$bool = $file->is_complete;
Returns true if "add_block" has added enough blocks to match "size".
mode
$file = $file->mode(0644); # 0644 == 420
$int = $file->mode;
The file mode. Note that this is 10-base, meaning $int
will be something like "420" and not "644".
mtime
$file = $file->mtime(time);
$epoch = $file->mtime;
Epoch timestamp for this file.
owner
$file = $file->owner('jhthorsen')
$str = $file->owner;
The string representation of "uid".
path
$file = $file->path('some/file/or/directory');
$str = $file->path;
The path from the tar file. This is constructed with both the filename and prefix (if any) in the ustar tar format.
size
$file = $file->size(42);
$int = $file->size;
The size of the file in bytes.
symlink
$file = $file->symlink('path/for/symlink');
$str = $file->symlink;
This attribute is not fully supported yet. Pull request welcome!
type
$file = $file->type(5);
$str = $file->type;
The tar file type.
This attribute is currently EXPERIMENTAL and might change from raw representation to something more readable.
uid
$file = $file->uid(1001);
$int = $file->uid;
The numeric representation of "owner".
METHODS
add_block
$file = $file->add_block($bytes);
Used to add a block from of bytes from the tar file to the "asset".
from_header
$file = $file->from_header($bytes);
Will parse the header chunk from the tar file and set the "ATTRIBUTES".
to_header
$bytes = $file->to_header;
Will construct a header chunk from the "ATTRIBUTES".