-1

There is this solution but it is quite slow.

What is the fastest directory traversing method without npm packages?

Pradeep
  • 9,667
  • 13
  • 27
  • 34
D.Stone
  • 40
  • 5
  • Your best bet is to continue looking around and make your own benchmark, then you can actually write a blog post about it and tell the world. I've never needed to optimise precisely that part of an algorithm, but maybe other people like yourself will benefit that. :) – drinchev Dec 08 '18 at 19:24

1 Answers1

0

Welcome to Stack Overflow!

Keep in mind:

  • Filesystems are completely platform-dependent. The "fastest" way to traverse a filesystem will typically be via some low-level system API.
  • Any and all higher level-abstractions will necessarily be slower. I myself don't work with Node, but a cursory look at the fs and path APIs shows me it has analogs to all the usual POSIX-style calls.
  • So, you may want to broaden your search to the most efficient algorithms of filesystem traversal, in general, because if you find something to be "slow", its probably not a language-dependent problem. It is inefficiency in the algorithm.

Remember, this isn't a place where you're going to find people will readily "do your homework" for you. But if you want to try to narrow your question (explain what you're trying to accomplish), you might get responses closer to what you're looking for.

Geoff Nixon
  • 4,697
  • 2
  • 28
  • 34