Lazily write to a buffer