Skip to content

Save mime-type in binary if we know it #3192

Open

Description

@deontologician

When grabbing a file with r.http:

r.http('gravatar.com/avatar/0b1129eaca8152c556c200cd8d179187', {resultFormat: 'binary'})

We could save the mime-type in the binary pseudotype document:

{
"$reql_type$": "BINARY",
"data": ...
"mime": "image/png"
}

This wouldn't try to do any autodetection, just store what we were told by the remote server. We could also add mime term for getting and setting the mime-type manually, like:

some_binary.mime()
some_binary.mime('image/png')

Basically, I ran into this trying to use binaries in earnest today. I ended up needing to always store the mime-type alongside. It'd be nice to have rethinkDB handle that automatically.

Activity

  1. danielmewes commented on Oct 15, 2014

    @danielmewes
    Member

    I think some_binary.mime() should only be for getting the mime type, not for setting it.
    For setting a mime type, we could add an opt arg {mime: ...} to the r.binary() constructor.

    Putting into subsequent. Let's discuss this more in the next ReQL discussion period.

  2. added this to the subsequent milestone on Oct 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions