Skip to content

Deprecation FileStreamer-like object #2083

Closed
@ericproulx

Description

@ericproulx

Hi,

I would like stream attachments through grape. By reading the doc, I can do this :

class AttachmentStream
  attr_reader :response
  def initialize(response)
    @response = response
  end

  def each
    yield response.read_body
  end
end

source = URI(@attachment_context.url)
Net::HTTP.start(source.host, source.port, use_ssl: true) do |http|
  req = Net::HTTP::Get.new source
   http.request(req) do |res|
     stream AttachmentStream.new(res)
   end
end

Unfortunately, there is a warning that says :

'[DEPRECATION] Argument as FileStreamer-like object is deprecated. Use path to file instead.'

Is is still relevant ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions