I implemented something similar to this solution, but it's not ideal.
I have a few issues with this though. I set the block size pretty low, to ensure the APPEND trick works well, which it does, but the overhead for the APPEND call is not great. A 55 kB stream (i.e. roughly 50 separate APPENDS) turns a 50 ms operation into 2 seconds.
Sure, it'll be much less bad when I create the buffer size, but this suggests that while the idea works, it's not perfect.
https://codeberg.org/loke/array/commit/c41c9daa5aceb46b4dbfcab1ac34389646d3be5e