add encode.bytesWritten
tests for bytesWritten
docs for bytesWritten