This repository has been archived by the owner. It is now read-only.
An ActiveFedora mixin that allows a datastream dissemination response to be streamed back
Ruby
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
Gemfile
LICENSE.txt
README.textile
active_fedora_streamable.gemspec

README.textile

An ActiveFedora mixin that allows a datastream dissemination response to be streamed back in blocks without reading all content into memory.

Include the mixin in your ActiveFedora::Datastream subclass:

class BigData < ActiveFedora::Datastream
  include ActiveFedora::Streamable::Datastreams
end
class DataContainer < ActiveFedora::Base
  has_file_datastream :name=>'bigData', :type=> BigData
end

and then set the response_body in your controller:

DataContainer.find('demo:1').bigData.stream(self)

The iterator returned from #stream will write the bytes of a datastream dissemination back to the client in segments, without reading all of the content into memory first. It will not assign the output of the datastream dissemination to the ActiveFedora::Datastream’s content attribute.