Sha256: 6e3a126a3485dc2bd33ad4c1296e486c7bbc215457d6f6189bd7b0f21e06da39

Contents?: true

Size: 877 Bytes

Versions: 8

Compression:

Stored size: 877 Bytes

Contents

require 'uricp/version'
require 'uricp/curl_primitives'
require 'uricp/orbit_auth'
require 'uricp/segmenter'

module Uricp
  UnsupportedURLtype = Class.new(ArgumentError)
end

# Monkey patch a copy_stream facility in using 'sendfile'
unless IO.respond_to? :copy_stream
  require 'sendfile'

  def IO.copy_stream(src, dst, copy_length = nil, offset = nil)
    if src.stat.pipe?
      amount = copy_length.to_i
      buf_size = [amount, 2**16].min
      buffer = ''
      while amount > 0
        src.read(buf_size, buffer)
        amount_read = buffer.length
        dst.write(buffer)
        amount -= amount_read
        break if src.eof?
      end
      copy_length.to_i - amount
    else
      current_pos = src.pos
      count = dst.sendfile(src, offset || current_pos, copy_length)
      src.seek(count, IO::SEEK_CUR)
      count
    end
  rescue EOFError
    0
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
uricp-0.0.24 lib/segment_upload.rb
uricp-0.0.23 lib/segment_upload.rb
uricp-0.0.22 lib/segment_upload.rb
uricp-0.0.21 lib/segment_upload.rb
uricp-0.0.20 lib/segment_upload.rb
uricp-0.0.18 lib/segment_upload.rb
uricp-0.0.17 lib/segment_upload.rb
uricp-0.0.16 lib/segment_upload.rb