new_file(..., :largefile => :stream) avoids chunking
[ruby-mogilefs-client.git] / lib / mogilefs / http_tempfile.rb
blob501952233c06d58cd93de97f070f8fc77dbba62c
1 # -*- encoding: binary -*-
2 # here are internal implementation details, do not rely on them in your code
3 require 'tempfile'
4 require 'mogilefs/http_file'
6 class MogileFS::HTTPTempfile < Tempfile
7   def initialize(*args)
8     @mogilefs_httpfile_args = args
9     super("mogilefs-client")
10     unlink
11   end
13   def commit
14     rewind
15     tmp = MogileFS::HTTPFile.new(*@mogilefs_httpfile_args)
16     tmp.big_io = to_io
17     tmp.commit
18   end
20   def close
21     commit
22     super
23   end
24 end