When the latest revision of an attachment is retrieved, if
is used in
, we can avoid reading the entire file content into memory.
is basically fine but the buffer size should be 8k reather than 4k.
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
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.