Convos::Plugin::Files::File - Represents a paste

  1. DESCRIPTION
  2. ATTRIBUTES
    1. asset
    2. filename
    3. id
    4. path
    5. saved
    6. types
    7. user
    8. write_only
  3. METHODS
    1. handle_message_to_paste_p
    2. load_p
    3. mime_type
    4. public_url
    5. save_p
    6. to_message
    7. uri
  4. SEE ALSO

DESCRIPTION

Convos::Plugin::Files::File is a class used by represent an uploaded file.

ATTRIBUTES

asset

$str = $file->asset;

Holds a Mojo::Asset::File object.

filename

$str = $file->filename;
$file = $file->filename($str);

Holds the original filename.

id

$str = $file->id;

Returns an ID for the file that will be used publically in the generated URL.

path

$path = $file->path;

Returns a Mojo::File object for where the asset should be on disk.

saved

$dt = $file->saved;

Holds a date-tim string for when the file was saved.

types

$types = $file->types;

Holds a Mojolicious::Types object, used by "mime_type".

user

$user = $file->user;

Holds a Convos::Core::User object.

write_only

$bool = $file->write_only;
$file = $file->write_only(true);

Used to write files that should only be used internally by Convos, instead of read by visitors on the web.

METHODS

handle_message_to_paste_p

$p = Convos::Plugin::Files::File
      ->handle_message_to_paste_p($backend, $connection, $message)
      ->then(sub { my $file = shift });

This method will be called when a Convos::Core::Connection wants to create a paste.

load_p

$p = $file->load_p->then(sub { my $file = shift });

Used to load meta information from disk.

mime_type

$str = $file->mime_type;

Used to get the mime type of this file. Defaults to "application/octet-stream".

public_url

$path = $file->public_url;

Returns a Mojo::Path object useful for making a public URL.

save_p

$p = $file->save_p->then(sub { my $file = shift });

to_message

$str = $file->to_message;

Converts this objcet into a message you can send to a channel or user.

uri

$path = $file->uri;

Returns a Mojo::Path object representing the file on disk.

SEE ALSO

Convos.