INNER CODE UNIT · JavaScript

readProtoFiles

elys-network/elys · scripts/camel2snake/index.js:34

function readProtoFiles(dir) {
  const entries = fs.readdirSync(dir, { withFileTypes: true });

  // Array to hold all the .proto files
  let protoFiles = [];

  for (let entry of entries) {
    const fullPath = path.join(dir, entry.name);
    if (entry.isDirectory()) {
      // If entry is a directory, recursively search it for .proto files
      protoFiles = protoFiles.concat(readProtoFiles(fullPath));
    } else if (path.extname(entry.name) === '.proto') {
      // If entry is a .proto file, add it to the array
      protoFiles.push(fullPath);
    }
  }

  return protoFiles;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…