Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to retrieve a part of an object by defining a range? #346

Open
thomasfaure opened this issue Apr 26, 2022 · 1 comment
Open

How to retrieve a part of an object by defining a range? #346

thomasfaure opened this issue Apr 26, 2022 · 1 comment

Comments

@thomasfaure
Copy link

I have implemented the php-opencloud/openstack library, and I use it to retrieve objects (object_store/v1).

I use the retrieve function that allows me to retrieve the content of an object,

but how to retrieve a part of an object using "range" defined in the request header with this library?

It seems possible, see the Api.php extract :

public function getObject(): array
    {
        return [
            'method' => 'GET',
            'path'   => '{containerName}/{+name}',
            'params' => [
                'containerName'     => $this->params->containerName(),
                'name'              => $this->params->objectName(),
                'range'             => $this->params->range(),
                'ifMatch'           => $this->params->ifMatch(),
                'ifNoneMatch'       => $this->params->ifNoneMatch(),
                'ifModifiedSince'   => $this->params->ifModifiedSince(),
                'ifUnmodifiedSince' => $this->params->ifUnmodifiedSince(),
            ],
        ];
    }
@sirhanshafahath
Copy link

$stream = $openstack->objectStoreV1()
->getContainer('{containerName}')
->getObject('{objectName}')
->download([
'range' => 'bytes=0-1023'
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants