Skip to content

Download an object's last n bytes #2030

Description

@frcroth

Downloading objects via byte ranges is supported (https://cloud.google.com/storage/docs/samples/storage-download-byte-range). However, seeking the channel does not work when I need to download the last n bytes of an object.
This is supported in the HTTP Range header with a negative value, describing the suffix length. (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range).

Ideally I would like to give another parameter to download, an option object describing that or a new RangeReader.

Is this feature already implemented?

Describe alternatives you've considered
A possible workaround could be to first get the size and use this to get the start position. This is not ideal, as it would require two HTTP requests.

Additional context
In Go this was already discussed and implemented (googleapis/google-cloud-go#1540). However, I am not sure, if the seekable channel would support something like this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the googleapis/java-storage API.type: questionRequest for information or clarification. Not an issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions