का उपयोग कर S3 में किसी मौजूदा या नई बनाई गई फ़ाइल में टेक्स्ट अटैचमेंट कैसे मौजूदा S3 फ़ाइल के अंत में सामग्री जोड़ें। मैं fog
उपयोग कर रहा हूँ और मैं कोडरूबी - कोहरे
require 'fog'
file = "abc.csv"
bucket = 'my_bucket'
storage = Fog::Storage.new(:provider => 'AWS', :aws_access_key_id => 'XXXXXXXX', :aws_secret_access_key => 'YYYYYYYY')
dir = connection.directories.new(:key => bucket) # no harm, if this bucket already exists, if not create one
buffer = ["big_chunk1", "big_chunk2", "big_chunk3", "big_chunk4", "big_chunk5"]
# I need help after this line. No changes above.
buffer.each do |chunk|
# this will not work as it will not append text below the existing file or
# newly created one. I am not looking for solution suggesting, buffer.join('')
# and then write whole chunk at once. I have to write in chuck for some specific reason.
# Also I dont want to first read existing data and then take in to memory
# and then append and finally write back.
dir.files.create(:key => file, :body => chunk, :public => false)
end
धन्यवाद @ फ्रेडरिक चेंग। मैं इतना अनुसंधान करने के बाद एक ही निष्कर्ष तक पहुंच गया हूं। वैसे, क्या आप जानते हैं कि धुंध का उपयोग करके एस 3 यूआरएल पर हस्ताक्षर कैसे करें? कोहरे दस्तावेज़ों में आसानी से इसके बारे में कोई जानकारी नहीं मिली। – JVK