Skip to content

[objects] How do I use ExtractContent with Download? #2548

@pierreprinetti

Description

@pierreprinetti

The documentation for objects.Download states:

Download is a function that retrieves the content and metadata for an object. To extract just the content, pass the DownloadResult response to the ExtractContent function.

The wording, although a bit confusing (ExtractContent is a method, non a function), seems to suggest that something like this is possible:

	b, err := objects.Download(client, "container", "object", nil).ExtractContent()
	if err != nil {
		panic(err)
	}
	fmt.Printf("---\n%s\n---\n", b)

However, this doesn't work because the result of Download is a bare DownloadResult value, while ExtractContent is a method with a pointer receiver.

What is the recommended way to use ExtractContent?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions