Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.Distribution = exports.DistributionFileType = void 0;
  4. const fs = require("fs-extra");
  5. const error_1 = require("../error");
  6. const logger_1 = require("../logger");
  7. const pathUtil = require("path");
  8. var DistributionFileType;
  9. (function (DistributionFileType) {
  10. DistributionFileType["IPA"] = "ipa";
  11. DistributionFileType["APK"] = "apk";
  12. DistributionFileType["AAB"] = "aab";
  13. })(DistributionFileType = exports.DistributionFileType || (exports.DistributionFileType = {}));
  14. class Distribution {
  15. constructor(path) {
  16. this.path = path;
  17. if (!path) {
  18. throw new error_1.FirebaseError("must specify a release binary file");
  19. }
  20. const distributionType = path.split(".").pop();
  21. if (distributionType !== DistributionFileType.IPA &&
  22. distributionType !== DistributionFileType.APK &&
  23. distributionType !== DistributionFileType.AAB) {
  24. throw new error_1.FirebaseError("Unsupported file format, should be .ipa, .apk or .aab");
  25. }
  26. let stat;
  27. try {
  28. stat = fs.statSync(path);
  29. }
  30. catch (err) {
  31. logger_1.logger.info(err);
  32. throw new error_1.FirebaseError(`File ${path} does not exist: verify that file points to a binary`);
  33. }
  34. if (!stat.isFile()) {
  35. throw new error_1.FirebaseError(`${path} is not a file. Verify that it points to a binary.`);
  36. }
  37. this.path = path;
  38. this.fileType = distributionType;
  39. this.fileName = pathUtil.basename(path);
  40. }
  41. distributionFileType() {
  42. return this.fileType;
  43. }
  44. readStream() {
  45. return fs.createReadStream(this.path);
  46. }
  47. getFileName() {
  48. return this.fileName;
  49. }
  50. }
  51. exports.Distribution = Distribution;