When the latest revision of an attachment is retrieved, if
TWiki::Store::getAttachmentStream()
is used in
TWiki::UI::View::viewfile()
, we can avoid reading the entire file content into memory.
TWiki::Engine::finalizeBody()
is basically fine but the buffer size should be 8k reather than 4k.
TWiki::Response::body()
doesn't assume a file handle as its argument, hence needs a slight enhancement. Overall, 20 lines or so of code change achive the goal.
This is really helpful when
viewfile
needs to handle a file of the gigabyte range.
You probably don't allow such a large file to be attached, but it can be generated by
TWiki:Plugins/PublishContrib
(if it's configured to put published files in an attachment area) or other plugins.
--
TWiki:Main/HideyoImazu
- 2016-01-17