Permalink
Browse files

Return GridIO object instead of file contents

GridIO implements `each`, so Rack can stream files in chunks
  • Loading branch information...
1 parent b34d0c9 commit 565d5664e1b41fce071a177386ed8e5689319ba2 @ches ches committed Jan 5, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/rack/gridfs.rb
View
@@ -38,7 +38,7 @@ def call(env)
def gridfs_request(id)
file = Mongo::Grid.new(db).get(BSON::ObjectId.from_string(id))
- [200, {'Content-Type' => file.content_type}, [file.read]]
+ [200, {'Content-Type' => file.content_type}, file]
rescue Mongo::GridFileNotFound, BSON::InvalidObjectId
[404, {'Content-Type' => 'text/plain'}, ['File not found.']]
end

0 comments on commit 565d566

Please sign in to comment.