Jesus / dropbox_api

Ruby client library for Dropbox API v2
MIT License
171 stars 113 forks source link

file downloading #9

Closed santoshkumar611 closed 7 years ago

santoshkumar611 commented 7 years ago

when downloading file, metadata of file object was generated but file content not generated , I searched methods on the file metadata object but i can't succed.

Jesus commented 7 years ago

The file content is yielded to the block. Example:

dropbox_client = DropboxApi::Client.new

File.open("local_file", "w") do |f|
  dropbox_client.download "/photo.jpg" do |chunk|
    f.write chunk
  end
end
dechenyu commented 4 years ago

Hi @Jesus, this worked but needs force encoding currently.

dropbox_client = DropboxApi::Client.new

File.open("local_file", "w") do |f|
  dropbox_client.download "/photo.jpg" do |chunk|
    f.write chunk.force_encoding("UTF-8")
  end
end