Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. const fsStat = require("@nodelib/fs.stat");
  4. const fsWalk = require("@nodelib/fs.walk");
  5. const reader_1 = require("./reader");
  6. class ReaderSync extends reader_1.default {
  7. constructor() {
  8. super(...arguments);
  9. this._walkSync = fsWalk.walkSync;
  10. this._statSync = fsStat.statSync;
  11. }
  12. dynamic(root, options) {
  13. return this._walkSync(root, options);
  14. }
  15. static(patterns, options) {
  16. const entries = [];
  17. for (const pattern of patterns) {
  18. const filepath = this._getFullEntryPath(pattern);
  19. const entry = this._getEntry(filepath, pattern, options);
  20. if (entry === null || !options.entryFilter(entry)) {
  21. continue;
  22. }
  23. entries.push(entry);
  24. }
  25. return entries;
  26. }
  27. _getEntry(filepath, pattern, options) {
  28. try {
  29. const stats = this._getStat(filepath);
  30. return this._makeEntry(stats, pattern);
  31. }
  32. catch (error) {
  33. if (options.errorFilter(error)) {
  34. return null;
  35. }
  36. throw error;
  37. }
  38. }
  39. _getStat(filepath) {
  40. return this._statSync(filepath, this._fsStatSettings);
  41. }
  42. }
  43. exports.default = ReaderSync;