Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8726035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:10:16+00:00 2026-06-13T08:10:16+00:00

Amazon S3 API for Ruby only streams objects when passing a block to the

  • 0

Amazon S3 API for Ruby only streams objects when passing a block to the read method.
I’m developing a driver for em-ftpd, and It needs an IOish object to stream the S3 data to the client.
If simply pass myS3Object.read, whole file is loaded into the memory, as stated by S3 API.
Is there any way of encapsulating that into something like a custom IO class, so I can pass the stream to em-ftpd?

Here is my code:

def get_file(path)
  #loading whole file into memory - not efficient
  yield bucket.objects[path].read
end

Here is the code inside em-ftpd that gets the result of my code, preferably as an IOish object, using a block to get its data chunks:

# send a file to the client
def cmd_retr(param)
  send_unauthorised and return unless logged_in?
  send_param_required and return if param.nil?

  path = build_path(param)

  @driver.get_file(path) do |data|
    if data
      send_response "150 Data transfer starting #{data.size} bytes"
      send_outofband_data(data)
    else
      send_response "551 file not available"
    end
  end
end

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:10:17+00:00Added an answer on June 13, 2026 at 8:10 am

    Turns out that I needed to create a class with a buffer of the S3 data and the methods read and eof?.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the item_search method of the amazon product api, but noticed that even
I'm using the Amazon Product Advertising API (amazon-ecs) Ruby library - how can I
I'm accessing the Amazon AWS API using the ruby-aaws gem, but without going to
I have read much documentation on the Amazon API and am still not clear
I try to use amazon API using PHP. If I use print_r($parsed_xml->Items->Item->ItemAttributes) it show
What is the easiest way to use the Amazon Product API on the Google
The zend framework provides a php wrapper for the amazon S3 api that simplifies
Am using below third party API in my project development http://undesigned.org.za/2007/10/22/amazon-s3-php-class I have done
I am currently having trouble with results from the Amazon API. The service returns
I am designing an API system in Ruby-on-Rails, and I want to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.