marcel/aws-s3 — Issue #49: S3Object.store $stdin
Author: tarnfeld
Created: 2011-12-18 11:08:20+00:00
State: open

Hey,

I've been trying to build a tool that allows me to put some data from STDIN into S3, and I have hit a brick wall with your S3 library. When I try to call `AWS::S3::S3Object.store(path, $stdin, bucket)` I get an exception thrown...

/Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:41:in `request': undefined method `size' for # (NoMethodError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:52:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:69:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:88:in `put'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:241:in `store'
from ./s3pipe.rb:115

Everything works great if I call `$stdin.read` however the data i'm piping into my ruby program is upwards of 2GB, and i'm running this on low memory machines.

By the looks of things, your relying on a few methods that are only defined in the File class, and not handling raw IO objects. It would be *aweseomeee* if you could fix this bug :-)! I can't wait to open source this little ruby file i'm writing!

Thanks.