writeWhile
Append number of chunks invoking block function while the returned value is true.
Depending on the output underlying implementation it could invoke block function with the same buffer several times
however it is guaranteed that it is always non-empty.