App-MatrixTool
view release on metacpan or search on metacpan
lib/App/MatrixTool/Command/client/upload.pm view on Meta::CPAN
my $self = shift;
my ( $opts, $file, $type ) = @_;
my $content = read_binary( $file );
unless( defined $type ) {
$type = "image/jpeg" if $file =~ m/\.jp[e]?g$/;
$type = "image/png" if $file =~ m/\.png$/;
defined $type or
die "Type not specified and could not guess it from the filename\n";
}
$self->do_json( POST => "/_matrix/media/r0/upload",
content => $content,
content_type => $type,
)->then( sub {
my ( $result ) = @_;
$self->output_ok( "Uploaded content" );
( run in 0.764 second using v1.01-cache-2.11-cpan-702932259ff )