Why not just convert every array-like chunk in chunks into a buffer after line 372? then the type check won't be necessary here and below. And when chunks are fully bufferified, just remove the conversion code we are good to go. minor point given that this is still WIP