Skip to content

Get binary data from Content API with raw media type #14

Open
@andrewcarter

Description

@andrewcarter

Using repos.getContents with mediaType: { format: "raw" }

Even though the raw content type is specified, the returned data.content is still stringified so it's unsuitable to use with binary data it seems. For example, if requesting an image, the binary data will be mangled.

Is there any way to get around this with octokit/rest? The only way I found was to set mediaType: { format: "object" } and then un-base64 encode the returned content, which obviously is not optimal.

Otherwise, I may just fetch the raw data directly bypassing octokit/rest.

Relates to octokit/octokit.js#507

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions