6 ms·
It's worth pointing out that Node has a built in globbing function: https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesglobpattern-options:~:text=dir1/%
by throwitaway1123 1y ago
It's worth pointing out that Node has a built in globbing function: https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesglobpattern-options:~:text=dir1/%20dir2/.-,fsPromises.glob(pattern%5B%2C%20options%5D),-%23 https://nodejs.org/docs/latest-v24.x/api/fs.html#fspromisesg...
> Also there's arguably design. Should a 'glob' library actually read the file system and give you filenames or should it just tell you if a string matches a glob and leave the reset to you?
There's a function in Node's stdlib that does this as well (albeit it's marked as experimental): https://nodejs.org/docs/latest-v24.x/api/path.html#pathmatchesglobpath-pattern:~:text=COPY-,path.matchesGlob(path%2C%20pattern),-%23 https://nodejs.org/docs/latest-v24.x/api/path.html#pathmatch...