Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fast glob ramdisk issue #431

Closed
fawazahmed0 opened this issue Nov 12, 2023 · 0 comments
Closed

fast glob ramdisk issue #431

fawazahmed0 opened this issue Nov 12, 2023 · 0 comments

Comments

@fawazahmed0
Copy link

fawazahmed0 commented Nov 12, 2023

Environment

  • OS Version: macOS-13
  • Node.js Version: 21.1.0
  • fast glob version: ^3.2.12

Actual behavior

cannot read files in ramdisk

Expected behavior

should read files in ramdisk

I am not 100% sure whether it's due to ramdisk or what.

Ramdisk was created using

diskutil erasevolume HFS+ myramdisk $(hdiutil attach -nobrowse -nomount ram://2097152)

and is accessible in /Volumes/myramdisk.

I replaced the code

await fg(path.posix.join(...pathToDir.split(path.sep), '**'), { dot: true });

to

native node js version

// lists all files and directories in folder, returns full path
async function listDirRecursive(pathToDir, onlyFiles, onlyDir){
    let result = await fs.readdir(pathToDir,{withFileTypes:true, recursive:true})
    if(onlyFiles)
    result = result.filter(e=>e.isFile())
    else if(onlyDir)
    result = result.filter(e=>e.isDirectory())
 
    return result.map(e=>path.join(e.path,e.name))
 
 }

await listDirRecursive(pathToDir, true)

And everything works fine with native nodejs version.

I will close this issue, because my issue is already solved with native nodejs version, but just thought of letting you know.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant