Python feature suggestion - load (binary) content from file
mark at basho.com
Mon Apr 11 19:14:44 EDT 2011
Thanks for the sending this along. This looks pretty slick.
The fastest path to seeing something like this in the client would be
to send us a pull request via GitHub.
You have a few minutes to put one together?
On Sun, Apr 10, 2011 at 7:49 AM, Ana Nelson <nelson.ana at gmail.com> wrote:
> I've just implemented this in a project:
> binary_data = open(self.filename(), "rb").read()
> mimetype, encoding = mimetypes.guess_type(self.filename())
> if not mimetype:
> mimetype = 'application/octet-stream' # Riak's own default
> self.riak_object = self.bucket.new_binary(
> which writes binary data to a Riak bucket from a file, using Python's
> mimetypes library to determine the content type from the file's extension.
> I think it could be convenient to have this be included in the Riak Python
> client, so perhaps it can implement better buffering. Something like
> bucket.new_binary_from_file(key, filename)
> riak-users mailing list
> riak-users at lists.basho.com
More information about the riak-users