diff options
Diffstat (limited to 'lib/mogilefs/new_file.rb')
-rw-r--r-- | lib/mogilefs/new_file.rb | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/mogilefs/new_file.rb b/lib/mogilefs/new_file.rb index baac6e2..d7ade5b 100644 --- a/lib/mogilefs/new_file.rb +++ b/lib/mogilefs/new_file.rb @@ -7,8 +7,8 @@ # of awkward APIs. # # It is possible to stream large content of known length any WebDAV server. -# One example of this is for mirroring a file from an existing HTTP server without download downloading - +# One example of this is for mirroring a large file from an existing HTTP +# server to \MogileFS without letting it hit the local filesystem. # # uri = URI('http://example.com/large_file') # Net::HTTP.start(uri.host, uri.port) do |http| @@ -20,16 +20,12 @@ # else # warn "trying to upload with Transfer-Encoding: chunked" # warn "this is not supported by all WebDAV servers" -# io = mg.new_file('key', :largefile => :chunked) +# io = mg.new_file('key', :largefile => :stream) # end # response.read_body { |buf| io.write(buf) } # io.close # end # end - -# nf = mg.new_file("key", :largefile => stream, :content_length => ) -# nf.write(buf) -# nf.close # # If your WebDAV servers have chunked PUT support (e.g. Perlbal), you can # stream a file of unknown length using "Transfer-Encoding: chunked". @@ -49,11 +45,12 @@ # nf.close # # Finally, if your WebDAV servers does not support either partial nor -# nor chunked PUTs, you must buffer a file of unknown length using a -# Tempfile: +# 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 # module MogileFS::NewFile |