Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Ranged download doesn't work with get_filename or get_callback #129

@juhaszp-uhu

Description

@juhaszp-uhu

Net::Amazon::S3::Client::Object::Range provides a way to download just a part of an object. This works with $object->range("bytes=0-1000")->get(). However, the get_filename and get_callback methods don't work, they don't do anything if range is used (they do work as $object's methods, though).

Complete example:


use Modern::Perl '2021';
use Net::Amazon::S3::Client;
use Data::Dumper;

my $aws_access_key_id = '...';
my $aws_secret_access_key = '...';
my $host = '...';
my $bucket_name = '...;
my $key = '...';

my $client = Net::Amazon::S3::Client->new (
        host                  => $host,
        aws_access_key_id     => $aws_access_key_id,
        aws_secret_access_key => $aws_secret_access_key,
        secure                => 0,
        retry                 => 0,
        error_handler_class   => 'Net::Amazon::S3::Error::Handler::Status',
);

my $bucket = $client->bucket( name => $bucket_name );

my $object;
$object = $bucket->object( key => $key);

$object->range('bytes=0-10000')->get_callback(sub {
        my $s = length($_[0]);
        print "chunk received, size $s\n";
        # do something with chunk
});

Also, get_callback is not documented at all for Net::Amazon::S3::Client::Object, and Net::Amazon::S3::Client::Object::Range is only rudimentarily documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions