Comments (8)
I'm not sure if this is the same issue:
+ fixtures
+ dir1
+ dir2
// I expect this to return [ 'dir1', 'dir2' ]
// and it does
const results = await glob(['fixtures/*'], { onlyDirectories: true });
// I expect this to return [ 'fixtures' ],
// but it returns [ ]
const results = await glob(['fixtures'], { onlyDirectories: true });
from fast-glob.
Hello, @dylang,
Looks like separated issue. Please create a issue for your problem.
I can say right now, that this is works on my machine:
tree fixtures/
fixtures/
├── b
│ └── c
│ ├── md.md
│ └── txt.txt
├── md.md
└── txt.txt
const fg = require('fast-glob');
const entries0 = fg.sync(['fixtures/*'], { onlyDirectories: true });
console.dir(entries0, { colors: true }); // [ 'fixtures/b' ]
const entries1 = fg.sync(['fixtures'], { onlyDirectories: true });
console.dir(entries1, { colors: true }); // [ 'fixtures' ]
Are you sure you're using the latest version of the package? But I need more information about your case. Your version of the fast-glob
package, OS and etc.
from fast-glob.
@mrmlnc You are correct, older version via globby
at fault, thanks for the quick reply!
from fast-glob.
Blocked by migrate to @nodelib/fs.walk
(nodelib/nodelib#9).
from fast-glob.
I am executing this code:
const glob = require('fast-glob').sync
console.log(glob('/*', { onlyFiles: false }))
And I get []
as the output. I am using MacOS and v12.14.0.
I think this problem is related with this issue, but maybe it's a different one.
from fast-glob.
Nope, if you want to get only directories, then you need to use the onlyDirectories
option. When you disable the onlyFiles
option the onlyDirectories
option is not automatically enabled.
from fast-glob.
I don't want only directories, I want to get all dirs and files of my root directory, but instead I am getting an empty array, and I can assure you my root directory is not empty.
P.S. even if I wanted only directories, I have just tested this code:
const glob = require('fast-glob').sync
console.log(glob('/*', { onlyFiles: false, onlyDirectories: true }))
...and it also displays []
.
from fast-glob.
Any update on a fix for this? This issue is preventing me switching to fast-glob from node-glob (without a breaking change)..
$ tree
.
├── 1
│ ├── one
│ └── two
│ └── three
$ echo 1/**
1/ 1/one 1/two 1/two/three
$ node
Welcome to Node.js v16.2.0.
> fg = require('fast-glob')
> fg.sync(['1/**'], { onlyFiles: false })
[ '1/one', '1/two', '1/two/three' ]
As you can see in the example above, bash expands 1/**
to four paths while fast-glob only expands to three paths ('1/'
is missing).
from fast-glob.
Related Issues (20)
- TypeError: patterns.reduce is not a function HOT 10
- Breaking changes in v3.3.0 HOT 1
- Type definitions erroneously disallow passing an explicitly readonly array of strings HOT 1
- Use `os.availableParallelism` instead of `os.cpus().length` when available HOT 1
- Merging DEFAULT_FILE_SYSTEM_ADAPTER to fs HOT 4
- Regression in v3.3.1 HOT 3
- Case sensitive file paths are returned as potentially the wrong case when using WSL with window's paths HOT 1
- Inconsistent File Format Handling Between Windows and POSIX in fast-glob HOT 7
- Unable to match correctly HOT 1
- fast glob ramdisk issue
- [doc] what is the behaviour of passing an array of patterns?
- Allow abort glob progress
- In Node.js v20.11.0, it's not possible to match directories containing emojis.
- Directory globs with and without trailing slash in ignore patterns have different results
- No results returned if the file is a socket HOT 1
- [QUESTION] - Awilix.fast-glob Fails to Autoload Modules in Tests with TypeScript Setup
- Inconsistent file count HOT 1
- Ignore patterns are applied to the absolute path instead of relative to the working directory HOT 4
- New fast-glob version required due to dependency CVE in micromatch HOT 3
- Matching failed when adding drive's name in Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fast-glob.