module Protocol::HTTP::Body::Reader

def save(path, mode = ::File::WRONLY|::File::CREAT|::File::TRUNC, **options)

@parameter options [Hash] additional options to pass to `File.open`.
@parameter mode [Integer] the mode to open the file with.
@parameter path [String] the path to write the body to.

Write the body of the response to the given file path.
def save(path, mode = ::File::WRONLY|::File::CREAT|::File::TRUNC, **options)
	if @body
		::File.open(path, mode, **options) do |file|
			self.each do |chunk|
				file.write(chunk)
			end
		end
	end
end