Check if folder is mountPoint

Hi all, I would like check if a folder is a mount point using a function in node-red. I try looking for fs or os function without success.
Can someone help me?

in newer versions of node-red you can add fs and os in the setup tab

chrome_KSh4x3UgNy

Note the rich help in the editor? This is achieved by setting the code editor to monaco (in settings.js)

many many thanks, Can I ask you if you know the correct function to check if folder is mount point in fs or os library?

never tried.

try running fs.realpath and fs.stat against various paths and mount points - see if you can identify the difference?

Failing that, use the exec node to execute shell commands.

Earlier I solved the same type of need but in a slightly different way:

  • I created the folder in the space on my RPi and then I put a file inside with the name "unmounted"

  • in the volume folder that then was mounted I put a file with the name "mounted"

(If you are worried those files might be deleted by mistake, you can always change access rights for them)

When unmounting/mounting the volume I can see the file names change accordingly. In this way you can check if it is mounted or not, both visually and programmatically. Maybe the suggestions from @Steve-Mcl fits your needs better, however I have not tried those myself

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.