Buffer write in place with tmp file