Is there any way to read macOS's "st_flags" field returned by stat() from nodeJS?

Viewed 115

Today I found out that one of the several ways in which macOS can mark files as hidden is to use an extra set of "flags" in it's stat struct that it inherited from BSD.

On Mac you can see them by doing ls -lO. On the BSDs you can see them by doing ls -lo.

I've found that at least the Python that comes with Macs supports these extra fields (not sure if all Pythons can see them), and of course I can access them from C.

But is there any way to access them from Node? I usually consider Node to be pretty good at this kind of thing but it's definitely not in its stat support, nor can I find it in any module on NPM, or mentioned anywhere on the net. I also don't know how trivial it is to do it in C and call it from Node, but I'm about to look into it.

But perhaps I'm missing something. Even if people rarely code for Mac-specific stuff these days, I'm more surprised that it hasn't been added so the BSDs can make use of it. Maybe nodeJS hasn't been popular on those platforms?

So how might I read and set these flags from nodeJS code?

0 Answers
Related