I'm trying to download the google document file with Ruby. I can't find the path for the downloaded file. I commanded with 'export_file' method in ruby like following:
file_id = 'xxxxxx' content = google_drive.export_file(file_id, 'application/pdf', download_dest: StringIO.new)
The response is as below in the console.
Writing chunk (1389 bytes) Writing chunk (1389 bytes) Writing chunk (1389 bytes) Writing chunk (1389 bytes) Writing chunk (896 bytes) Writing chunk (2 bytes) Writing chunk (1234 bytes) Success - #
=> #
Seems like something was downloaded but in the rails, I can't find the path for the downloaded file. I tried to search the file with the name ( the name I can see in the Google document) in vain.
How can I access the downloaded file? How can I access "content"? Please share your insight with me!
Best
This will just add string to the StringIo object you need to write it to file after it is done
stringObj = StringIO.new
file_id = 'xxxxxx' content = google_drive.export_file(file_id, 'application/pdf', download_dest: stringObj )
File.open('detination.txt', 'w') do |f|
f.puts(stringObj.read)
end