Use tmp from npm config; clean up code using promises