GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
874 B

2 months ago
  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;