do not write a needlessly large buffer for small files
avoid unnecessary array allocation
Merge pull request #1841 from mtbc/trac-11250-manage-transfer-buffer-size

assist #11250: manage transfer buffer size