def read(options = nil, &block)
options ||= {}
raise ArgumentError, 'Either you\'re attempting to read a file from another host (which we don\'t support), or you used two slashes by mistake, where you should have file:///<path>.' if host
path = real_path
raise NotFoundError, "Looking for #{self} and can't find it." unless File.exists?(path)
raise NotFoundError, "Looking for the file #{self}, and it happens to be a directory." if File.directory?(path)
File.open path, 'rb' do |input|
with_progress_bar options[:progress], path.split('/').last, input.stat.size do |progress|
block ? block.call(input.read) : input.read
end
end
end