We fetch into a temp directory now and then fs.rename() into the target dir. With fs.rename() being an atomic operation we don't leave target dir in an inconsistent state if failure happen in some parallel installation process.