thecodrr / fdir

⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
https://thecodrr.github.io/fdir/
MIT License
1.51k stars 58 forks source link

Fdir can't get content of subfolders #49

Closed ewochtl closed 3 years ago

ewochtl commented 3 years ago

System: Windows Server 2019 Version 1809 (Build 17763.737) Node.js Version: 12.18.2 fdir Version: 3.4.3

In my project, I have a OneDrive sync, mapped as Network drive. When i run fdir on this, I only get the files in the root directory of the Network Drive. But, when i map another folder as network drive, with the same code, fdir outputs all dirs and files, as it should.

My Code:

const fdir = require("fdir")

var paths = "R:\\"

var files = new fdir().withDirs().withMaxDepth(3).crawlWithOptions(paths,{includeBasePath:true, includeDirs:true, suppressErrors:false}).sync();

files.forEach(file_path => {
    console.log(file_path)
})

Screenshot of the execution in Drive R:\ : image

Screenshot of the execution in Drive S:\ : image

Do you have an idea of a fix for the issue? How can i debug fdir? How can i see errors?

thecodrr commented 3 years ago

Hey! Thank you for creating an issue here.

First of all, you are using both crawlWithOptions and the Builder pattern; they don't work well together. crawlWithOptions overrides the other options. So the correct usage would be:

const fdir = require("fdir")

var paths = "R:\\"

var files = new fdir().withDirs().withMaxDepth(3).withBasePath().withErrors().crawl(paths).sync();

files.forEach(file_path => {
    console.log(file_path)
})

Try the above code, perhaps it will fix your bug. I have no Windows PC where I could reproduce this bug however, I will try to be as helpful as possible if you decide to debug and fix this yourself. I haven't tried fdir with network drives so your contribution with regards to that would be most welcome!

ewochtl commented 3 years ago

Hi, thanks for your responding. Unfortunately your Code didn't change the result. It's still the same output. Can you send me instructions, how i can debug the module or how i can enable advanced logging. Regards

papb commented 3 years ago

Have you tried with fdir v5?

ewochtl commented 3 years ago

@papb Thanks for your help Still no changes with fdir 5.0 But I've tested a snippet for directory listing from Stack Overflow: https://stackoverflow.com/a/5827895/14878833 When I run this, it works fine.

thecodrr commented 3 years ago

@ewochtl if you have nvm try out fdir on Node v8.x.

ewochtl commented 3 years ago

Hi @thecodrr ! Now, with node 8.17.0 it works! Thank you for your help!

papb commented 3 years ago

Wait, so it works on Node 8 but does not work on Node 12?

ewochtl commented 3 years ago

Yes @papb