暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.readFile = exports.dirExistsSync = exports.fileExistsSync = void 0;
  4. const fs_1 = require("fs");
  5. const error_1 = require("./error");
  6. function fileExistsSync(path) {
  7. try {
  8. return (0, fs_1.statSync)(path).isFile();
  9. }
  10. catch (e) {
  11. return false;
  12. }
  13. }
  14. exports.fileExistsSync = fileExistsSync;
  15. function dirExistsSync(path) {
  16. try {
  17. return (0, fs_1.statSync)(path).isDirectory();
  18. }
  19. catch (e) {
  20. return false;
  21. }
  22. }
  23. exports.dirExistsSync = dirExistsSync;
  24. function readFile(path) {
  25. try {
  26. return (0, fs_1.readFileSync)(path).toString();
  27. }
  28. catch (e) {
  29. if (e.code === "ENOENT") {
  30. throw new error_1.FirebaseError(`File not found: ${path}`);
  31. }
  32. throw e;
  33. }
  34. }
  35. exports.readFile = readFile;