warn "this is not supported by all WebDAV servers" io = mg.new_file('key', :largefile => :stream) end response.read_body { |buf| io.write(buf) } io.close end end
If your WebDAV servers have chunked PUT support (e.g. Perlbal), you can stream a file of unknown length using "Transfer-Encoding: chunked".
nf = mg.new_file("key", :largefile => :stream) nf.write "hello" nf.write ... nf.close
If your WebDAV server has partial PUT support (e.g Apache), you can you can use multiple PUT requests with "Content-Range" support. This method is slower than Transfer-Encoding: chunked.
nf = mg.new_file("key", :largefile => :content_range) nf.write "hello" nf.write ... nf.close
Finally, if your WebDAV servers does not support either partial nor nor chunked PUTs, you must buffer a large file of unknown length using a Tempfile:
nf = mg.new_file("key", :largefile => :tempfile) nf.write "hello" nf.write ... nf.close
mail archives: https://yhbt.net/mogilefs-client-public/ http://ou63pmih66umazou.onion/mogilefs-client-public/ nntp://news.public-inbox.org/inbox.comp.file-systems.mogilefs.ruby nntp://ou63pmih66umazou.onion/inbox.comp.file-systems.mogilefs.ruby public: mogilefs-client-public@yhbt.net source code: git clone https://yhbt.net/mogilefs-client.git torsocks git clone http://ou63pmih66umazou.onion/mogilefs-client.git