This repository has been archived on 2022-03-12. You can view files and clone it, but cannot push or open issues or pull requests.

45 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2021-04-02 02:24:13 +03:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.downloadAndUnzip = void 0;
function _cliTools() {
const data = require("@react-native-community/cli-tools");
_cliTools = function () {
return data;
};
return data;
}
var _unzip = require("./unzip");
var _deleteFile = require("./deleteFile");
/**
* Downloads `downloadUrl` and unzips the contents to `installPath` while
* updating the message of `loader` at each step.
*/
const downloadAndUnzip = async ({
loader,
downloadUrl,
component,
installPath
}) => {
loader.start(`Downloading ${component} from "${downloadUrl}" (this may take a few minutes)`);
const installer = await (0, _cliTools().fetchToTemp)(downloadUrl);
loader.text = `Installing ${component} in "${installPath}"`;
try {
await (0, _unzip.unzip)(installer, installPath);
} finally {
await (0, _deleteFile.deleteFile)(installer);
}
};
exports.downloadAndUnzip = downloadAndUnzip;
//# sourceMappingURL=downloadAndUnzip.js.map