Closed subframe7536 closed 9 months ago
I'm not sure about this change. I can understand that in the case where shuffling all the bytes to the new end of the file could benefit from a larger buffer. But a 1mb buffer is pretty large for some scenarios (eg, an ID3v2 tag at the end of the file is being updated - this may only need a small buffer, allocating 1MB buffer would be wasteful, imho).
How about a compromise. We know how many bytes the file contents need to be shuffled, how about if it's greater than 1MB we use a BUFFER_SIZE * 1024
size, if it's less than 1MB we use BUFFER_SIZE
.
Indeed. Now _bufferSize
is allocated on demand
see #94